2016-02-17 11:36:14 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
from app import notify_celery, create_app
|
|
|
|
|
from credstash import getAllSecrets
|
|
|
|
|
import os
|
2016-03-17 11:47:44 +00:00
|
|
|
|
|
|
|
|
default_env_file = '/home/ubuntu/environment'
|
|
|
|
|
environment = 'live'
|
|
|
|
|
|
|
|
|
|
if os.path.isfile(default_env_file):
|
2016-03-17 12:51:14 +00:00
|
|
|
with open(default_env_file, 'r') as environment_file:
|
|
|
|
|
environment = environment_file.readline().strip()
|
2016-02-17 11:36:14 +00:00
|
|
|
|
|
|
|
|
# on aws get secrets and export to env
|
2016-03-17 12:51:14 +00:00
|
|
|
os.environ.update(getAllSecrets(region="eu-west-1"))
|
2016-02-17 11:36:14 +00:00
|
|
|
|
2016-03-17 13:21:01 +00:00
|
|
|
from config import configs
|
|
|
|
|
|
2016-03-17 11:47:44 +00:00
|
|
|
os.environ['NOTIFY_API_ENVIRONMENT'] = configs[environment]
|
|
|
|
|
|
2016-02-17 11:36:14 +00:00
|
|
|
application = create_app()
|
|
|
|
|
application.app_context().push()
|