properly parse NO_SSL env var (#126)

Bug fix:
The default for `NO_SSL` environment variable is `False`.
When the actual value, in runtime, is `True`, the code "ignores" it.
The reason: the code does not parse the given string. So it evaluates a non empty string as "True".
To resolve this, the suggested code parses the given string to a boolean value.
This commit is contained in:
Ron Klein 2020-09-14 18:57:13 +03:00 committed by GitHub
parent 8a3a7f7c39
commit 5c9d3bf3cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,8 +9,9 @@ from flask import abort, Flask, render_template, request
from redis.exceptions import ConnectionError from redis.exceptions import ConnectionError
from werkzeug.urls import url_quote_plus from werkzeug.urls import url_quote_plus
from werkzeug.urls import url_unquote_plus from werkzeug.urls import url_unquote_plus
from distutils.util import strtobool
NO_SSL = os.environ.get('NO_SSL', False) NO_SSL = bool(strtobool(os.environ.get('NO_SSL', 'False')))
URL_PREFIX = os.environ.get('URL_PREFIX', None) URL_PREFIX = os.environ.get('URL_PREFIX', None)
TOKEN_SEPARATOR = '~' TOKEN_SEPARATOR = '~'