Added code to read environemnt from a file

If file does not exist default to live config.
This commit is contained in:
Martyn Inglis
2016-02-09 13:41:20 +00:00
parent db3c787caf
commit c2424d6509

10
wsgi.py
View File

@@ -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()