From 5c9d3bf3cfcdb041fa213d433c24bc1240afacc8 Mon Sep 17 00:00:00 2001 From: Ron Klein Date: Mon, 14 Sep 2020 18:57:13 +0300 Subject: [PATCH] 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. --- snappass/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/snappass/main.py b/snappass/main.py index 7339333..3e04d0d 100644 --- a/snappass/main.py +++ b/snappass/main.py @@ -9,8 +9,9 @@ from flask import abort, Flask, render_template, request from redis.exceptions import ConnectionError from werkzeug.urls import url_quote_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) TOKEN_SEPARATOR = '~'