diff options
author | Kjetil Orbekk <kj@orbekk.com> | 2022-12-28 19:32:08 -0500 |
---|---|---|
committer | Kjetil Orbekk <kj@orbekk.com> | 2022-12-28 19:32:08 -0500 |
commit | c5e818d7a7fc282ab4b626fd19b45f530d5898c8 (patch) | |
tree | e1831f97a9ce84fd70b561f0bb325a4472fccae9 /modules | |
parent | 61633d1c8e2c746adc681ecb04658abb5f02a195 (diff) |
Configure bridge-nightly secret key
Diffstat (limited to 'modules')
-rw-r--r-- | modules/bridge.nix | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/modules/bridge.nix b/modules/bridge.nix index a1c405a..e41af2e 100644 --- a/modules/bridge.nix +++ b/modules/bridge.nix @@ -1,9 +1,6 @@ { config, lib, pkgs, ... }: -let - cfg = config.orbekk.bridge; -in -with lib; -{ +let cfg = config.orbekk.bridge; +in with lib; { options = { orbekk.bridge = { enable = mkEnableOption "Enable bridge service"; @@ -17,18 +14,20 @@ with lib; }; config = mkIf cfg.enable { + age.secrets.bridge-nightly.file = ./. + "../secrets/bridge-nightly.age"; + systemd.services.bridge-nightly = { description = "Bridge Nightly backend"; - wantedBy = ["multi-user.target"]; - after = ["network.target"]; + wantedBy = [ "multi-user.target" ]; + after = [ "network.target" ]; environment = { BIND_ADDRESS = "[::]:${toString cfg.port}"; RUST_BACKTRACE = "1"; AUTHENTICATOR = "oauth"; - OPENID_ISSUER_URL= "https://auth.orbekk.com/realms/test"; - OPENID_CLIENT_ID= "test-client"; - OPENID_CLIENT_SECRET= "secret"; + OPENID_ISSUER_URL = "https://auth.orbekk.com/realms/test"; + OPENID_CLIENT_ID = "test-client"; + OPENID_CLIENT_SECRET = "secret"; APP_URL = "https://bridge.orbekk.com"; DATABASE_URL = "postgres:///bridge_nightly"; RUST_LOG = "info"; @@ -37,7 +36,7 @@ with lib; serviceConfig = { User = "bridge_nightly"; Group = "bridge_nightly"; - EnvironmentFile = config.age.secrets.bridge-nighly.path; + EnvironmentFile = config.age.secrets.bridge-nightly.path; ExecStart = "/opt/bridge-nightly/profile/bin/server"; }; }; @@ -57,12 +56,10 @@ with lib; host all all 2001:470:8e2e:100::/64 md5 ''; ensureDatabases = [ "bridge_nightly" ]; - ensureUsers = [ - { - name = "bridge_nightly"; - ensurePermissions."DATABASE bridge_nightly" = "ALL PRIVILEGES"; - } - ]; + ensureUsers = [{ + name = "bridge_nightly"; + ensurePermissions."DATABASE bridge_nightly" = "ALL PRIVILEGES"; + }]; }; }; } |