diff --git a/modules/services/pizauth.nix b/modules/services/pizauth.nix index 0b77b0e1..4afc5947 100644 --- a/modules/services/pizauth.nix +++ b/modules/services/pizauth.nix @@ -60,7 +60,8 @@ in }; clientSecret = mkOption { - type = types.str; + type = types.nullOr types.str; + default = null; description = '' The OAuth2 client secret. ''; @@ -128,6 +129,8 @@ in ${indent}auth_uri = "${acc.authUri}"; ${indent}token_uri = "${acc.tokenUri}"; ${indent}client_id = "${acc.clientId}"; + '' + + lib.optionalString (acc.clientSecret != "" && acc.clientSecret != null) '' ${indent}client_secret = "${acc.clientSecret}"; '' + lib.optionalString (acc.scopes != [ ] && acc.scopes != null) '' @@ -164,6 +167,7 @@ in Unit = { Description = "Pizauth OAuth2 token manager"; After = [ "network.target" ]; + X-Restart-Triggers = [ "${config.xdg.configFile."pizauth.conf".source}" ]; }; Service = { diff --git a/tests/modules/services/pizauth/basic-config.nix b/tests/modules/services/pizauth/basic-config.nix index 9578dd9f..dd5a18ab 100644 --- a/tests/modules/services/pizauth/basic-config.nix +++ b/tests/modules/services/pizauth/basic-config.nix @@ -28,6 +28,13 @@ "offline_access" ]; }; + test3 = { + authUri = "authUri3"; + tokenUri = "tokenUri3"; + clientId = "clientId3"; + scopes = [ + ]; + }; }; }; @@ -64,6 +71,12 @@ "offline_access" ]; } + + account "test3" { + auth_uri = "authUri3"; + token_uri = "tokenUri3"; + client_id = "clientId3"; + } ''} ''; };