mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-16 10:12:32 -05:00
Bring DB script into line with other prod scripts
This commit is contained in:
16
db.py
16
db.py
@@ -4,9 +4,19 @@ from app import create_app, db
|
|||||||
from credstash import getAllSecrets
|
from credstash import getAllSecrets
|
||||||
import os
|
import os
|
||||||
|
|
||||||
secrets = getAllSecrets(region="eu-west-1")
|
default_env_file = '/home/ubuntu/environment'
|
||||||
for key, val in secrets.items():
|
environment = 'live'
|
||||||
os.environ[key] = val
|
|
||||||
|
if os.path.isfile(default_env_file):
|
||||||
|
with open(default_env_file, 'r') as environment_file:
|
||||||
|
environment = environment_file.readline().strip()
|
||||||
|
|
||||||
|
# on aws get secrets and export to env
|
||||||
|
os.environ.update(getAllSecrets(region="eu-west-1"))
|
||||||
|
|
||||||
|
from config import configs
|
||||||
|
|
||||||
|
os.environ['NOTIFY_API_ENVIRONMENT'] = configs[environment]
|
||||||
|
|
||||||
application = create_app()
|
application = create_app()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user