running: mention systemd's EnvironmentFile directive (#362)

* running: mention systemd's `EnvironmentFile` directive

* mention real path example
This commit is contained in:
Mohammed Al Sahaf 2023-12-19 10:53:02 +03:00 committed by GitHub
parent 839ec63c38
commit 519e744daf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -144,6 +144,12 @@ For example, if you need to define environment variables for use in your config,
Environment="CF_API_TOKEN=super-secret-cloudflare-tokenvalue"
```
Similarly, if you prefer to maintain a separate file to maintain the environment variables (envfile), you may use the [`EnvironmentFile`](https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html#EnvironmentFile=) directive as such:
```systemd
[Service]
EnvironmentFile=/etc/caddy/.env
```
Or, for example if you need to change the config file from the default of the Caddyfile, to instead using a JSON file (note that `Exec*` directives [must be reset with empty strings](https://www.freedesktop.org/software/systemd/man/systemd.service.html#ExecStart=) before setting a new value):
```systemd
[Service]