nixos/package/tubesync/database-local-socket.patch

28 lines
1.2 KiB
Diff

diff --git a/tubesync/tubesync/local_settings.py.container b/tubesync/tubesync/local_settings.py.container
index a7a07ab..7564138 100644
--- a/tubesync/tubesync/local_settings.py.container
+++ b/tubesync/tubesync/local_settings.py.container
@@ -34,14 +34,20 @@ if database_connection_env:
database_dict = parse_database_connection_string(database_connection_env)
+database_host = database_dict.get("HOST")
+if database_host == "localhost":
+ database_dict["HOST"] = None
+ database_dict["PASSWORD"] = None
+
+
if database_dict:
log.info(f'Using database connection: {database_dict["ENGINE"]}://'
- f'{database_dict["USER"]}:[hidden]@{database_dict["HOST"]}:'
+ f'{database_dict["USER"]}:[hidden]@{database_host}:'
f'{database_dict["PORT"]}/{database_dict["NAME"]}')
DATABASES = {
'default': database_dict,
}
- DATABASE_CONNECTION_STR = (f'{database_dict["DRIVER"]} at "{database_dict["HOST"]}:'
+ DATABASE_CONNECTION_STR = (f'{database_dict["DRIVER"]} at "{database_host}:'
f'{database_dict["PORT"]}" database '
f'"{database_dict["NAME"]}"')
else: