Skip to content

Commit 2aa1d08

Browse files
fixed location of plaintext apiKey as environment variable in systemd service config (#264)
* fixed location of plaintext apiKey as environment variable in systemd services attrset * Fix formatting --------- Co-authored-by: Kiri Carlson <kiri@walawren.com>
1 parent ad47448 commit 2aa1d08

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

modules/arr-common/mkArrServiceModule.nix

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,11 @@ in
300300

301301
systemd.services.${serviceName} = {
302302
description = capitalizedName;
303-
environment = mkServarrSettingsEnvVars (toUpper serviceBase) cfg.settings;
303+
environment =
304+
mkServarrSettingsEnvVars (toUpper serviceBase) cfg.settings
305+
// optionalAttrs (cfg.config.apiKey != null && !apiKeyIsSecretRef) {
306+
${apiKeyEnvVar} = toString cfg.config.apiKey;
307+
};
304308

305309
after = [
306310
"network.target"
@@ -331,9 +335,6 @@ in
331335
}
332336
// optionalAttrs apiKeyIsSecretRef {
333337
LoadCredential = [ "apiKey:${toString cfg.config.apiKey._secret}" ];
334-
}
335-
// optionalAttrs (cfg.config.apiKey != null && !apiKeyIsSecretRef) {
336-
environment.${apiKeyEnvVar} = toString cfg.config.apiKey;
337338
};
338339
};
339340
}

0 commit comments

Comments
 (0)