Skip to content
Snippets Groups Projects
Commit d8fe1014 authored by Julian's avatar Julian
Browse files

Fix config loading for Debian package

CONFIG_FILENAME in uwsgi.ini was copy-pasted from uffd without adding
support for it in uffd-nginxauth. However, the way it is used for uffd
does not work anyway, since it is appended to the app's instance_path
(it sets the filename not the path!). For some reason linking the config
file to "config.cfg" in the instance folder, does not work either.

This change introduces the environment variable CONFIG_PATH. If set, it's
value is used as is for reading the config file.
parent 68ddf6ef
No related branches found
No related tags found
No related merge requests found
Pipeline #9051 passed
...@@ -10,10 +10,12 @@ def create_app(test_config=None): ...@@ -10,10 +10,12 @@ def create_app(test_config=None):
app = Flask(__name__) app = Flask(__name__)
app.config['SECRET_KEY'] = secrets.token_hex(128) app.config['SECRET_KEY'] = secrets.token_hex(128)
app.config.from_pyfile('default_config.py') app.config.from_pyfile('default_config.py')
if not test_config: if test_config:
app.config.from_pyfile('config.py', silent=True)
else:
app.config.from_mapping(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 # 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 # 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. # reflect the actual request url, so we disable this check.
......
/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/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 /etc/uwsgi/apps-available/uffd-nginxauth.ini /etc/uwsgi/apps-enabled/uffd-nginxauth.ini
...@@ -11,6 +11,6 @@ vacuum = true ...@@ -11,6 +11,6 @@ vacuum = true
env = PYTHONIOENCODING=UTF-8 env = PYTHONIOENCODING=UTF-8
env = LANG=en_GB.utf8 env = LANG=en_GB.utf8
env = TZ=Europe/Berlin 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 chdir = /usr/share/uffd-nginxauth
module = app:create_app() module = app:create_app()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment