Proper dynamic config reload

A bunch of options can now be changed without a restart as the config is
now guaranteed to be reloaded on change through the use of a RELOADCONFIG environment variable.
This commit is contained in:
2020-07-12 19:53:04 +01:00
parent 27169e4e0d
commit d615b21c7d
15 changed files with 148 additions and 115 deletions

View File

@@ -1,15 +1,16 @@
# Web views
from pathlib import Path
from flask import Flask, send_from_directory, render_template
from jellyfin_accounts import app, g, css_file, data_store
from jellyfin_accounts import config, app, g, css_file, data_store
from jellyfin_accounts import web_log as log
from jellyfin_accounts.web_api import config, checkInvite, validator
from jellyfin_accounts.web_api import checkInvite, validator
if config.getboolean("ui", "bs5"):
bsVersion = 5
else:
bsVersion = 4
def bsVersion():
if config.getboolean("ui", "bs5"):
return 5
return 4
@app.errorhandler(404)
@@ -42,7 +43,7 @@ def static_proxy(path):
if "html" not in path:
if "admin.js" in path:
return (
render_template("admin.js", bsVersion=bsVersion, css_file=css_file),
render_template("admin.js", bsVersion=bsVersion(), css_file=css_file),
200,
{"Content-Type": "text/javascript"},
)
@@ -75,7 +76,7 @@ def inviteProxy(path):
successMessage=config["ui"]["success_message"],
jfLink=config["jellyfin"]["public_server"],
validate=config.getboolean("password_validation", "enabled"),
requirements=validator.getCriteria(),
requirements=validator().getCriteria(),
email=email,
username=(not config.getboolean("email", "no_username")),
)