diff --git a/doc/ghostream.service b/doc/ghostream.service index 2f0b95e..348b61b 100644 --- a/doc/ghostream.service +++ b/doc/ghostream.service @@ -5,12 +5,12 @@ After=syslog.target [Service] User=www-data WorkingDirectory=/var/local/ghostream -Environment=FLASK_CONFIG=production -Environment=LDAP_URI=ldap://127.0.0.1:389 -Environment=LDAP_USER_DN=cn=Utilisateurs,dc=crans,dc=org -Environment=SITE_NAME=Crans Stream -Environment=SITE_HOSTNAME=stream.crans.org -Environment=FAVICON=https://www.crans.org/images/favicon.ico +Environment=FLASK_CONFIG="production" +Environment=LDAP_URI="ldap://127.0.0.1:389" +Environment=LDAP_USER_DN="cn=Utilisateurs,dc=crans,dc=org" +Environment=SITE_NAME="Crans Stream" +Environment=SITE_HOSTNAME="stream.crans.org" +Environment=FAVICON="https://www.crans.org/images/favicon.ico" ExecStart=/usr/bin/uwsgi --http-socket 127.0.0.1:8080 --master --plugin python3 --module ghostream:app --static-map /static=/var/local/ghostream/ghostream/static Restart=on-failure KillSignal=SIGQUIT diff --git a/ghostream/__init__.py b/ghostream/__init__.py index 3563666..c32fd9b 100644 --- a/ghostream/__init__.py +++ b/ghostream/__init__.py @@ -27,10 +27,12 @@ def auth(): # so just ignore login here, and NGINX will still allow streaming. return "Malformed request", 400 - bind_dn = f"cn={name},{app.config.LDAP_USER_DN}" + ldap_user_dn = app.config.get('LDAP_USER_DN') + bind_dn = f"cn={name},{ldap_user_dn}" try: # Try to bind LDAP as the user - connect = ldap.initialize(app.config.LDAP_URI) + ldap_uri = app.config.get('LDAP_URI') + connect = ldap.initialize(ldap_uri) connect.bind_s(bind_dn, password) connect.unbind_s() app.logger.info("%s logged in successfully", name)