Skip to content

Commit

Permalink
nixos/vaultwarden: use lib.concatMapAttrs
Browse files Browse the repository at this point in the history
  • Loading branch information
figsoda committed Nov 17, 2022
1 parent f4828b4 commit d1dd00b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions nixos/modules/services/security/vaultwarden/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ let
# we can only check for values consistently after converting them to their corresponding environment variable name.
configEnv =
let
configEnv = listToAttrs (concatLists (mapAttrsToList (name: value:
if value != null then [ (nameValuePair (nameToEnvVar name) (if isBool value then boolToString value else toString value)) ] else []
) cfg.config));
configEnv = concatMapAttrs (name: value: optionalAttrs (value != null) {
${nameToEnvVar name} = if isBool value then boolToString value else toString value;
}) cfg.config;
in { DATA_FOLDER = "/var/lib/bitwarden_rs"; } // optionalAttrs (!(configEnv ? WEB_VAULT_ENABLED) || configEnv.WEB_VAULT_ENABLED == "true") {
WEB_VAULT_FOLDER = "${cfg.webVaultPackage}/share/vaultwarden/vault";
} // configEnv;
Expand Down

0 comments on commit d1dd00b

Please sign in to comment.