From 02c5d7770dfa134d3fbe2865ff81ef09d55dd25f Mon Sep 17 00:00:00 2001 From: aprilthepink Date: Fri, 3 May 2024 19:16:31 +0200 Subject: [PATCH] fix: let module setup be correct --- module.nix | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/module.nix b/module.nix index a9d6532..4a6ef9f 100644 --- a/module.nix +++ b/module.nix @@ -223,6 +223,13 @@ in config = mkIf cfg.enable (lib.mkMerge [ localDatabaseConfig nginxConfig + systemd.services.lysandap + lib.mkIf cfg.database.createLocally { + systemd.services.lysandap.serviceConfig.Environment.DATABASE_URL = "postgresql:///${cfg.database.user}@localhost/${cfg.database.dbname}"; + } + lib.mkIf (cfg.database.createLocally == false) { + systemd.services.lysandap.serviceConfig.Environment.DATABASE_URL = "postgresql://${cfg.database.user}:${cfg.database.passwordFile}@${cfg.database.host}:${toString cfg.database.port}/${cfg.database.dbname}"; + } { systemd.services.lysandap = { wantedBy = [ "multi-user.target" ]; @@ -236,9 +243,6 @@ in Environment = { "PORT" = "${toString cfg.port}"; "ADDRESS" = "${cfg.address}:${toString cfg.port}"; - "DATABASE_URL" = lib.mkIf hasLocalPostgresDB - "postgresql:///${cfg.database.user}@localhost/${cfg.database.dbname}" - "postgresql://${cfg.database.user}:${cfg.database.passwordFile}@${cfg.database.host}:${toString cfg.database.port}/${cfg.database.dbname}"; "FEDERATED_DOMAIN" = cfg.domain; "SERVICE_SCALE" = toString cfg.serviceScale; "LOCAL_USER_NAME" = "example";