Comment 7 for bug 1573561

Revision history for this message
Stig Sandbeck Mathisen (ssm) wrote :

I strongly recommend you to use a way to configure your service in a way as to keep the entire commandline in one place, instead of keeping it in several files.

Environmentfiles are good for giving a running service environment variables for it to use after startup. I do not recommend using it for creating commandlines when there are other options available. With sysvinit it was the least-worst option.

If you _do_ want to split the options into another file, and you use systemd, please consider adding a /etc/systemd/system/varnish.service.d/read-options-from-environment.conf with:

[Service]
# at least one of...
EnvironmentFile=-/etc/sysconfig/varnish
EnvironmentFile=-/etc/default/varnish
EnvironmentFile=-/etc/varnish/environment
# Reset and set commandline
ExecStart=
ExecStart=/usr/sbin/varnishd $OPTIONS

Also, look at man:systemd.service(5) for how systemd parses whitespace inside variables for constructing command line arguments. You may need to add several option variables if some arguments contain whitespace.

Also, I do not think you should blame systemd for this. As the package maintainer, _I_ discourage the use of EnviromentFile= for command line arguments. Systemd does not, and documents it rather well.

You are free to use both ways to configure your service, and you can add a service configuration fragment to do so if you like.