I am new to Django, so I apologize in advance if this is a dumb question for whatever reason. We recently had an incident where there was a misconfiguration in our settings.py file for one of our prod services. Basically we had some code in there to pull a secret from GCP secret manager and load it into an environment variable, however the key in the actual secret was mistyped so it threw an error saying no environment variable with that name could be found.
The issue is this happened when the service was actually being deployed (to Cloud Run), which broke the deployment and left our service in a weird state. I am looking for a way to validate all of the environment variables for a specific settings file earlier in the process so it fails in the CI/CD process of our Github PR flow, so people can’t merge in changes that will break the deployment since their PR won’t succeed the build steps.
Our actual settings files are broken up into dev, prod, and test, and the test settings file is what is used in our testing step of our CI/CD pipeline, and that settings file had no issues, so we are looking for a way to also validate the prod version of the settings file.