| 1 | Environment Variables |
| 2 | --------------------- |
| 3 | |
| 4 | In Finit v4.3 support for setting environment variables in `finit.conf`, |
| 5 | and any `*.conf`, was added. It is worth noting that these are global |
| 6 | and *shared with all* services -- the only way to have a service-local |
| 7 | environment is detailed in [Services Environment](service-env.md). |
| 8 | |
| 9 | The syntax for global environment variables is straight forward. In |
| 10 | Finit v4.4 the `set` keyword was added for completeness, but the old |
| 11 | syntax (without the `set ` prefix) is still honored: |
| 12 | |
| 13 | set foo=bar |
| 14 | set baz="qux" |
| 15 | |
| 16 | On reload of .conf files, all tracked environment variables are cleared |
| 17 | so if `foo=bar` is removed from `finit.conf`, or any `finit.d/*.conf` |
| 18 | file, it will no longer be used by Finit or any new (!) started |
| 19 | run/tasks or services. The environment of already started processes can |
| 20 | not be changed. |
| 21 | |
| 22 | The only variables reset to sane defaults on .conf reload are: |
| 23 | |
| 24 | PATH=_PATH_STDPATH |
| 25 | SHELL=_PATH_BSHELL |
| 26 | LOGNAME=root |
| 27 | USER=root |
| 28 | |
| 29 | It is entirely possible to override these as well from the .conf files, |
| 30 | but be careful. Changing SHELL changes the behavior of `system()` and a |
| 31 | lot of other commands as well. |