mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-17 10:42:25 -05:00
Update as per pull request comments:
- context manager for file handling - os.environ.update for setting overrides
This commit is contained in:
@@ -8,13 +8,11 @@ default_env_file = '/home/ubuntu/environment'
|
||||
environment = 'live'
|
||||
|
||||
if os.path.isfile(default_env_file):
|
||||
environment_file = open(default_env_file, 'r')
|
||||
with open(default_env_file, 'r') as environment_file:
|
||||
environment = environment_file.readline().strip()
|
||||
|
||||
# on aws get secrets and export to env
|
||||
secrets = getAllSecrets(region="eu-west-1")
|
||||
for key, val in secrets.items():
|
||||
os.environ[key] = val
|
||||
os.environ.update(getAllSecrets(region="eu-west-1"))
|
||||
|
||||
os.environ['NOTIFY_API_ENVIRONMENT'] = configs[environment]
|
||||
|
||||
|
||||
7
wsgi.py
7
wsgi.py
@@ -9,14 +9,11 @@ default_env_file = '/home/ubuntu/environment'
|
||||
environment = 'live'
|
||||
|
||||
if os.path.isfile(default_env_file):
|
||||
environment_file = open(default_env_file, 'r')
|
||||
with open(default_env_file, 'r') as environment_file:
|
||||
environment = environment_file.readline().strip()
|
||||
|
||||
# on aws get secrets and export to env
|
||||
secrets = getAllSecrets(region="eu-west-1")
|
||||
for key, val in secrets.items():
|
||||
os.environ[key] = val
|
||||
|
||||
os.environ.update(getAllSecrets(region="eu-west-1"))
|
||||
os.environ['NOTIFY_API_ENVIRONMENT'] = configs[environment]
|
||||
|
||||
application = create_app()
|
||||
|
||||
Reference in New Issue
Block a user