Use read_config_bool for vars in app init (#848)

This commit is contained in:
João 2022-09-20 19:11:27 +02:00 committed by GitHub
parent 1aad47f2af
commit c42640e21c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,6 +15,8 @@ from dotenv import load_dotenv
from werkzeug.middleware.proxy_fix import ProxyFix
from app.utils.misc import read_config_bool
app = Flask(__name__, static_folder=os.path.dirname(
os.path.abspath(__file__)) + '/static')
@ -25,12 +27,12 @@ dot_env_path = (
'../whoogle.env'))
# Load .env file if enabled
if os.getenv('WHOOGLE_DOTENV', ''):
if read_config_bool('WHOOGLE_DOTENV'):
load_dotenv(dot_env_path)
app.default_key = generate_user_key()
if os.getenv('HTTPS_ONLY'):
if read_config_bool('HTTPS_ONLY'):
app.config['SESSION_COOKIE_NAME'] = '__Secure-session'
app.config['SESSION_COOKIE_SECURE'] = True