mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-03 07:31:28 -04:00
Start aligning Admin app with config styles used elsewhere
- no config overrides - now all set in environment - use different files for staging and live too allow for differently named env variables - updates to run_app and run_tests scripts to set correct environment (test/development) so correct config picked up - use environment file on deployed environments to pick correct config
This commit is contained in:
16
wsgi.py
16
wsgi.py
@@ -2,16 +2,22 @@ from app import create_app
|
||||
from credstash import getAllSecrets
|
||||
import os
|
||||
|
||||
config = 'live'
|
||||
default_env_file = '/home/ubuntu/environment'
|
||||
environment = 'live'
|
||||
|
||||
if os.path.isfile(default_env_file):
|
||||
environment = open(default_env_file, 'r')
|
||||
config = environment.readline().strip()
|
||||
with open(default_env_file, 'r') as environment_file:
|
||||
environment = environment_file.readline().strip()
|
||||
|
||||
secrets = getAllSecrets(region="eu-west-1")
|
||||
|
||||
application = create_app(config, secrets)
|
||||
# on aws get secrets and export to env
|
||||
os.environ.update(getAllSecrets(region="eu-west-1"))
|
||||
|
||||
from config import configs
|
||||
|
||||
os.environ['NOTIFY_ADMIN_ENVIRONMENT'] = configs[environment]
|
||||
|
||||
application = create_app()
|
||||
|
||||
if __name__ == "__main__":
|
||||
application.run()
|
||||
|
||||
Reference in New Issue
Block a user