mirror of
https://github.com/akuker/RASCSI.git
synced 2024-11-22 16:33:17 +00:00
Make the default config load on rascsi-web startup without having to load it in a browser. (#620)
This commit is contained in:
parent
089dc302e5
commit
31309a8ee3
@ -1021,17 +1021,14 @@ def change_language():
|
|||||||
|
|
||||||
|
|
||||||
@APP.before_first_request
|
@APP.before_first_request
|
||||||
def load_default_config():
|
def detect_locale():
|
||||||
"""
|
"""
|
||||||
Webapp initialization steps that require the Flask app to have started:
|
Get the detected locale to use for UI string translations.
|
||||||
- Get the detected locale to use for localizations
|
This requires the Flask app to have started first.
|
||||||
- Load the default configuration file, if found
|
|
||||||
"""
|
"""
|
||||||
session["language"] = get_locale()
|
session["language"] = get_locale()
|
||||||
ractl.locale = session["language"]
|
ractl.locale = session["language"]
|
||||||
file_cmds.locale = session["language"]
|
file_cmds.locale = session["language"]
|
||||||
if Path(f"{CFG_DIR}/{DEFAULT_CONFIG}").is_file():
|
|
||||||
file_cmds.read_config(DEFAULT_CONFIG)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
@ -1075,6 +1072,9 @@ if __name__ == "__main__":
|
|||||||
ractl = RaCtlCmds(sock_cmd=sock_cmd, token=APP.config["TOKEN"])
|
ractl = RaCtlCmds(sock_cmd=sock_cmd, token=APP.config["TOKEN"])
|
||||||
file_cmds = FileCmds(sock_cmd=sock_cmd, ractl=ractl, token=APP.config["TOKEN"])
|
file_cmds = FileCmds(sock_cmd=sock_cmd, ractl=ractl, token=APP.config["TOKEN"])
|
||||||
|
|
||||||
|
if Path(f"{CFG_DIR}/{DEFAULT_CONFIG}").is_file():
|
||||||
|
file_cmds.read_config(DEFAULT_CONFIG)
|
||||||
|
|
||||||
import bjoern
|
import bjoern
|
||||||
print("Serving rascsi-web...")
|
print("Serving rascsi-web...")
|
||||||
bjoern.run(APP, "0.0.0.0", arguments.port)
|
bjoern.run(APP, "0.0.0.0", arguments.port)
|
||||||
|
Loading…
Reference in New Issue
Block a user