Check for systemd environment variables that are too long

Issue #3403. For the case of $PATH being too long, we could call
buildEnv automatically.
This commit is contained in:
Eelco Dolstra 2014-07-30 10:28:05 +02:00
parent 6479d6fea4
commit 9956b97b2f

View file

@ -317,7 +317,9 @@ let
''
[Service]
${let env = cfg.globalEnvironment // def.environment;
in concatMapStrings (n: "Environment=\"${n}=${getAttr n env}\"\n") (attrNames env)}
in concatMapStrings (n:
let s = "Environment=\"${n}=${getAttr n env}\"\n";
in if stringLength s >= 2048 then throw "The value of the environment variable ${n} in systemd service ${name}.service is too long." else s) (attrNames env)}
${if def.reloadIfChanged then ''
X-ReloadIfChanged=true
'' else if !def.restartIfChanged then ''