diff --git a/modules/lndhub-go.nix b/modules/lndhub-go.nix index bd7bf0b00..1d1799aa6 100644 --- a/modules/lndhub-go.nix +++ b/modules/lndhub-go.nix @@ -61,6 +61,8 @@ let postgresql; configFile = builtins.toFile "lndhub-go-conf" (lib.generators.toKeyValue {} cfg.settings); + + dbName = "lndhubgo"; in { inherit options; @@ -74,11 +76,11 @@ in { }; services.postgresql = { enable = true; - ensureDatabases = [ "lndhubgo" ]; + ensureDatabases = [ dbName ]; ensureUsers = [ { name = cfg.user; - ensurePermissions."DATABASE lndhubgo" = "ALL PRIVILEGES"; + ensurePermissions."DATABASE ${dbName}" = "ALL PRIVILEGES"; } ]; }; @@ -86,7 +88,7 @@ in { services.lndhub-go.settings = { HOST = cfg.address; PORT = cfg.port; - DATABASE_URI = "postgresql://${cfg.user}:@localhost:${toString postgresql.port}/lndhubgo?sslmode=disable"; + DATABASE_URI = "unix://${cfg.user}@${dbName}/run/postgresql/.s.PGSQL.${toString postgresql.port}?sslmode=disable"; LND_ADDRESS = "${nbLib.addressWithPort lnd.address lnd.port}"; LND_MACAROON_FILE = "/run/lnd/lndhub-go.macaroon"; LND_CERT_FILE = lnd.certPath;