2016-02-09 13:41:20 +00:00
|
|
|
import os
|
|
|
|
|
|
2016-02-16 15:25:46 +00:00
|
|
|
from app import create_app
|
|
|
|
|
from credstash import getAllSecrets
|
2016-03-17 11:47:44 +00:00
|
|
|
from config import configs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default_env_file = '/home/ubuntu/environment'
|
|
|
|
|
environment = 'live'
|
|
|
|
|
|
|
|
|
|
if os.path.isfile(default_env_file):
|
|
|
|
|
environment_file = open(default_env_file, 'r')
|
|
|
|
|
environment = environment_file.readline().strip()
|
2015-12-15 16:37:54 +00:00
|
|
|
|
2016-02-16 15:25:46 +00:00
|
|
|
# on aws get secrets and export to env
|
2016-01-19 14:50:42 +00:00
|
|
|
secrets = getAllSecrets(region="eu-west-1")
|
2016-02-16 15:25:46 +00:00
|
|
|
for key, val in secrets.items():
|
|
|
|
|
os.environ[key] = val
|
2016-01-19 14:50:42 +00:00
|
|
|
|
2016-03-17 11:47:44 +00:00
|
|
|
os.environ['NOTIFY_API_ENVIRONMENT'] = configs[environment]
|
|
|
|
|
|
2016-02-16 15:25:46 +00:00
|
|
|
application = create_app()
|
2015-12-15 16:37:54 +00:00
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2016-03-17 11:47:44 +00:00
|
|
|
application.run()
|