1
0
mirror of https://gitlab.crans.org/nounous/ghostream.git synced 2024-12-23 01:32:19 +00:00

Fix configuration variable handling

This commit is contained in:
Alexandre Iooss 2020-09-14 14:28:37 +02:00
parent 7fd4396624
commit 92b0f5244e
No known key found for this signature in database
GPG Key ID: 6C79278F3FCDCC02
2 changed files with 10 additions and 8 deletions

View File

@ -5,12 +5,12 @@ After=syslog.target
[Service] [Service]
User=www-data User=www-data
WorkingDirectory=/var/local/ghostream WorkingDirectory=/var/local/ghostream
Environment=FLASK_CONFIG=production Environment=FLASK_CONFIG="production"
Environment=LDAP_URI=ldap://127.0.0.1:389 Environment=LDAP_URI="ldap://127.0.0.1:389"
Environment=LDAP_USER_DN=cn=Utilisateurs,dc=crans,dc=org Environment=LDAP_USER_DN="cn=Utilisateurs,dc=crans,dc=org"
Environment=SITE_NAME=Crans Stream Environment=SITE_NAME="Crans Stream"
Environment=SITE_HOSTNAME=stream.crans.org Environment=SITE_HOSTNAME="stream.crans.org"
Environment=FAVICON=https://www.crans.org/images/favicon.ico 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 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 Restart=on-failure
KillSignal=SIGQUIT KillSignal=SIGQUIT

View File

@ -27,10 +27,12 @@ def auth():
# so just ignore login here, and NGINX will still allow streaming. # so just ignore login here, and NGINX will still allow streaming.
return "Malformed request", 400 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:
# Try to bind LDAP as the user # 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.bind_s(bind_dn, password)
connect.unbind_s() connect.unbind_s()
app.logger.info("%s logged in successfully", name) app.logger.info("%s logged in successfully", name)