From d5b6a4ea27f8c905e613363aab365066ad6d9cda Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 5 Mar 2021 18:08:17 +0100 Subject: auth stuff. generate secret and create user from the cli --- animism-align/cli/app/settings/app_cfg.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'animism-align/cli/app/settings/app_cfg.py') diff --git a/animism-align/cli/app/settings/app_cfg.py b/animism-align/cli/app/settings/app_cfg.py index dfd0154..ceb9e43 100644 --- a/animism-align/cli/app/settings/app_cfg.py +++ b/animism-align/cli/app/settings/app_cfg.py @@ -33,6 +33,7 @@ load_dotenv(dotenv_path=fp_env) CLICK_GROUPS = { 'peaks': 'commands/peaks', 'site': 'commands/site', + 'admin': 'commands/admin', 'db': '', 'flask': '', 'viewer': '', @@ -83,6 +84,19 @@ try: except Exception as e: pass +# ----------------------------------------------------------------------------- +# Le crypto +# ----------------------------------------------------------------------------- + +TOKEN_SECRET = os.getenv("TOKEN_SECRET") or None +if TOKEN_SECRET is None: + import random + raise ValueError("Please set a token secret, e.g. " + hex(random.getrandbits(64 * 8)).replace('0x','')) + +TOKEN_SECRET_BYTES = bytearray() +TOKEN_SECRET_BYTES.extend(map(ord, TOKEN_SECRET)) + + # ----------------------------------------------------------------------------- # Exports # ----------------------------------------------------------------------------- -- cgit v1.2.3-70-g09d2