From 2e923c0441f6f2dc1234160862fc42d4f289e390 Mon Sep 17 00:00:00 2001 From: Jake Moshenko Date: Mon, 23 Jun 2014 11:24:54 -0400 Subject: [PATCH] Add config override to allow for specialization using environment variables. --- app.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app.py b/app.py index a4851e3b0..8fd6a43ef 100644 --- a/app.py +++ b/app.py @@ -1,5 +1,6 @@ import logging import os +import json from flask import Flask from flask.ext.principal import Principal @@ -26,6 +27,7 @@ from datetime import datetime OVERRIDE_CONFIG_FILENAME = 'conf/stack/config.py' +OVERRIDE_CONFIG_KEY = 'QUAY_OVERRIDE_CONFIG' LICENSE_FILENAME = 'conf/stack/license.enc' @@ -46,6 +48,9 @@ else: logger.debug('Applying config file: %s', OVERRIDE_CONFIG_FILENAME) app.config.from_pyfile(OVERRIDE_CONFIG_FILENAME) + environ_config = json.loads(os.environ.get(OVERRIDE_CONFIG_KEY, '{}')) + app.config.update(environ_config) + logger.debug('Applying license config from: %s', LICENSE_FILENAME) app.config.update(load_license(LICENSE_FILENAME))