diff options
author | Felix Singer <felixsinger@posteo.net> | 2024-03-24 02:40:39 +0100 |
---|---|---|
committer | Felix Singer <felixsinger@posteo.net> | 2024-03-30 08:21:18 +0100 |
commit | 0b11c8f47c29c8ef93631ca2fd077a661d30addb (patch) | |
tree | 73b8cad65827b56417f1da4c4327aa95fc045639 /nixos/modules/services/misc | |
parent | 8391b2c6abf96b208b98f6b144a1a66c89f0b76d (diff) |
nixos/redmine: Use attribute set for storing database settings
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Diffstat (limited to 'nixos/modules/services/misc')
-rw-r--r-- | nixos/modules/services/misc/redmine.nix | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/nixos/modules/services/misc/redmine.nix b/nixos/modules/services/misc/redmine.nix index d49e0856c875..1873d7da4cb9 100644 --- a/nixos/modules/services/misc/redmine.nix +++ b/nixos/modules/services/misc/redmine.nix @@ -10,16 +10,21 @@ let format = pkgs.formats.yaml {}; bundle = "${cfg.package}/share/redmine/bin/bundle"; - databaseYml = pkgs.writeText "database.yml" '' - production: - adapter: ${cfg.database.type} - database: ${cfg.database.name} - host: ${if (cfg.database.type == "postgresql" && cfg.database.socket != null) then cfg.database.socket else cfg.database.host} - port: ${toString cfg.database.port} - username: ${cfg.database.user} - password: #dbpass# - ${optionalString (cfg.database.type == "mysql2" && cfg.database.socket != null) "socket: ${cfg.database.socket}"} - ''; + databaseSettings = { + production = { + adapter = cfg.database.type; + database = cfg.database.name; + host = if (cfg.database.type == "postgresql" && cfg.database.socket != null) then cfg.database.socket else cfg.database.host; + port = cfg.database.port; + username = cfg.database.user; + } // optionalAttrs (cfg.database.passwordFile != null) { + password = "#dbpass#"; + } // optionalAttrs (cfg.database.type == "mysql2" && cfg.database.socket != null) { + socket = cfg.database.socket; + }; + }; + + databaseYml = format.generate "database.yml" databaseSettings; configurationYml = format.generate "configuration.yml" cfg.settings; additionalEnvironment = pkgs.writeText "additional_environment.rb" cfg.extraEnv; |