Skip to content

Commit

Permalink
redis: prevent infinite recursion when port is set to an env var
Browse files Browse the repository at this point in the history
Modules should take care not to conditionally set `env` using
user-provided input. If the conditional is another `env` value,
evaluation will fail with an infinite recursion error.

While the user can often easily break the loop on their end, knowing
what to do requires considerable experience with the module system.

Fixes #1440.
  • Loading branch information
sandydoo committed Sep 17, 2024
1 parent 1f55f89 commit 6128265
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/modules/services/redis.nix
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ in

env = {
REDISDATA = config.env.DEVENV_STATE + "/redis";
} // optionalAttrs (cfg.port == 0) { inherit REDIS_UNIX_SOCKET; };
REDIS_UNIX_SOCKET = if cfg.port == 0 then REDIS_UNIX_SOCKET else null;
};

processes.redis = {
exec = "${startScript}/bin/start-redis";
Expand Down

0 comments on commit 6128265

Please sign in to comment.