Merge pull request #53 from alphagov/setup-credstash

Incorporate credstash in production wsgi scripts.
This commit is contained in:
minglis
2016-01-10 21:41:56 +00:00
3 changed files with 9 additions and 3 deletions

View File

@@ -27,8 +27,6 @@ def create_app(config_name):
application.config['NOTIFY_ADMIN_ENVIRONMENT'] = config_name
application.config.from_object(configs[config_name])
if 'FLASK_CONFIG' in os.environ:
application.config.from_envvar('FLASK_CONFIG')
db.init_app(application)
init_app(application)
init_csrf(application)

View File

@@ -8,6 +8,7 @@ SQLAlchemy-Utils==0.30.5
Flask-WTF==0.11
Flask-Login==0.2.11
Flask-Bcrypt==0.6.2
credstash==1.8.0
git+https://github.com/alphagov/notify-api-client.git@0.1.4#egg=notify-api-client==0.1.4

View File

@@ -1,7 +1,14 @@
from app import create_app
import os
from credstash import getAllSecrets
application = create_app(os.getenv('NOTIFICATIONS_ADMIN_ENVIRONMENT') or 'development')
secrets = getAllSecrets(region="eu-west-1")
application = create_app(os.getenv('NOTIFICATIONS_ADMIN_ENVIRONMENT') or 'live')
for key in application.config.keys():
if key in secrets:
application.config[key] = secrets[key]
if __name__ == "__main__":
application.run()