Skip to content

Commit

Permalink
Merge pull request #1436 from Atry/patch-6
Browse files Browse the repository at this point in the history
feat: add environment variables for process-compose
  • Loading branch information
sandydoo authored Oct 31, 2024
2 parents 5c046ee + 16219e1 commit 45847cb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/modules/process-managers/process-compose.nix
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ in
};

config = lib.mkIf cfg.enable {
env = {
PC_CONFIG_FILES = toString cfg.configFile;
PC_SOCKET_PATH = if cfg.unixSocket.enable then cfg.unixSocket.path else null;
};

process.manager.args = {
"config" = cfg.configFile;
"port" = if !cfg.unixSocket.enable then toString cfg.port else null;
Expand All @@ -98,9 +103,12 @@ in
settings = {
version = lib.mkDefault "0.5";
is_strict = lib.mkDefault true;
# Filter out the recursive PC_CONFIG_FILES env.
# Otherwise, we would get a loop:
# PC_CONFIG_FILES -> configFile -> settings -> PC_CONFIG_FILES -> ...
environment = lib.mapAttrsToList
(name: value: "${name}=${toString value}")
config.env;
(builtins.removeAttrs config.env [ "PC_CONFIG_FILES" ]);
processes = lib.mapAttrs
(name: value:
let
Expand Down

0 comments on commit 45847cb

Please sign in to comment.