diff --git a/app.py b/app.py index 52e1e2c74e59716e5f2a86763ba24b4a3880bd69..366e516e8d2de6e41f301b4aaeee5c5aca7ebf88 100644 --- a/app.py +++ b/app.py @@ -10,10 +10,12 @@ def create_app(test_config=None): app = Flask(__name__) app.config['SECRET_KEY'] = secrets.token_hex(128) app.config.from_pyfile('default_config.py') - if not test_config: - app.config.from_pyfile('config.py', silent=True) - else: + if test_config: app.config.from_mapping(test_config) + elif os.environ.get('CONFIG_PATH'): + app.config.from_pyfile(os.environ['CONFIG_PATH'], silent=True) + else: + app.config.from_pyfile('config.py', silent=True) # OAuth2Session.fetch_token verifies that the passed URIs scheme (the scheme # of request.url) is HTTPS. The way we deploy this app, request.url does not # reflect the actual request url, so we disable this check. diff --git a/debian/links b/debian/links index 78050aa3a0db1c494b33e89468bd967f97521ceb..56e2fe902d97bcfb6f1960570904079cec9b35b0 100644 --- a/debian/links +++ b/debian/links @@ -1,3 +1,2 @@ -/etc/uffd-nginxauth/uffd-nginxauth.cfg /usr/share/uffd-nginxauth/instance/config.cfg /etc/uffd-nginxauth/uwsgi.ini /etc/uwsgi/apps-available/uffd-nginxauth.ini /etc/uwsgi/apps-available/uffd-nginxauth.ini /etc/uwsgi/apps-enabled/uffd-nginxauth.ini diff --git a/uwsgi.ini b/uwsgi.ini index 971017a339e43a5b7b95a07b56c107ca633bb2a4..8dabc69c57d1bd948069f2fcb7295f76b93eeec9 100644 --- a/uwsgi.ini +++ b/uwsgi.ini @@ -11,6 +11,6 @@ vacuum = true env = PYTHONIOENCODING=UTF-8 env = LANG=en_GB.utf8 env = TZ=Europe/Berlin -env = CONFIG_FILENAME=/etc/uffd-nginxauth/uffd-nginxauth.cfg +env = CONFIG_PATH=/etc/uffd-nginxauth/uffd-nginxauth.cfg chdir = /usr/share/uffd-nginxauth module = app:create_app()