Skip to content

Commit

Permalink
fixup svd: disallow double quotes in environment
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaofengli committed Sep 24, 2022
1 parent 46f00cc commit 711e4f3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion modules/supervisord.nix
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ let
autorestart = program.autoRestart;
environment = let
# FIXME: Make more robust
escape = builtins.replaceStrings [ "%" ] [ "%%" ];
escape = s:
assert lib.assertMsg (!(lib.hasInfix "\"" s)) "supervisord.programs.<name>.environment: Values cannot have double quotes at the moment (${s})";
builtins.replaceStrings [ "%" ] [ "%%" ] s;
envs = lib.mapAttrsToList (k: v: "${k}=\"${escape v}\"") program.environment;
in builtins.concatStringsSep "," envs;
} // program.extraConfig;
Expand Down

0 comments on commit 711e4f3

Please sign in to comment.