From c2424d650996f25ae8f3c05488cdb46f1c63f945 Mon Sep 17 00:00:00 2001 From: Martyn Inglis Date: Tue, 9 Feb 2016 13:41:20 +0000 Subject: [PATCH 1/2] Added code to read environemnt from a file If file does not exist default to live config. --- wsgi.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/wsgi.py b/wsgi.py index 138a48c6f..fd773b3e0 100644 --- a/wsgi.py +++ b/wsgi.py @@ -1,9 +1,17 @@ from app import create_app from credstash import getAllSecrets +import os + +config = 'live' +default_env_file = '/home/ubuntu/environment' + +if os.path.isfile(default_env_file): + environment = open(default_env_file, 'r') + config = environment.readline().strip() secrets = getAllSecrets(region="eu-west-1") -application = create_app('live', secrets) +application = create_app(config, secrets) if __name__ == "__main__": application.run() From 66763a061c18f4598cd04a5166b8137c92d4fcd8 Mon Sep 17 00:00:00 2001 From: Martyn Inglis Date: Tue, 9 Feb 2016 13:56:11 +0000 Subject: [PATCH 2/2] Added preview and staging config blocks --- config.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/config.py b/config.py index 8f728f1e1..6ec03eac7 100644 --- a/config.py +++ b/config.py @@ -36,12 +36,22 @@ class Test(Development): SQLALCHEMY_DATABASE_URI = 'postgresql://localhost/test_notification_api' +class Preview(Config): + pass + + +class Staging(Config): + pass + + class Live(Config): pass configs = { 'development': Development, + 'preview': Preview, + 'staging': Staging, 'test': Test, 'live': Live, }