root: add system check for database encoding (#15186)
* root: add system check for database encoding Signed-off-by: Jens Langhammer <jens@goauthentik.io> * oops Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
@ -10,7 +10,7 @@ from typing import Any
|
||||
from psycopg import Connection, Cursor, connect
|
||||
from structlog.stdlib import get_logger
|
||||
|
||||
from authentik.lib.config import CONFIG
|
||||
from authentik.lib.config import CONFIG, django_db_config
|
||||
|
||||
LOGGER = get_logger()
|
||||
ADV_LOCK_UID = 1000
|
||||
@ -115,9 +115,13 @@ def run_migrations():
|
||||
execute_from_command_line(["", "migrate_schemas"])
|
||||
if CONFIG.get_bool("tenants.enabled", False):
|
||||
execute_from_command_line(["", "migrate_schemas", "--schema", "template", "--tenant"])
|
||||
execute_from_command_line(
|
||||
["", "check"] + ([] if CONFIG.get_bool("debug") else ["--deploy"])
|
||||
)
|
||||
# Run django system checks for all databases
|
||||
check_args = ["", "check"]
|
||||
for label in django_db_config(CONFIG).keys():
|
||||
check_args.append(f"--database={label}")
|
||||
if not CONFIG.get_bool("DEBUG"):
|
||||
check_args.append("--deploy")
|
||||
execute_from_command_line(check_args)
|
||||
finally:
|
||||
release_lock(curr)
|
||||
curr.close()
|
||||
|
Reference in New Issue
Block a user