Closed icnocop closed 5 years ago
Environment variables can be defined in files. For example (this is how we use it, essentially): you have a file for a particular machine, which you place under e.g. /var/env/variables
as a part of your deployment, and which contains the following:
export MY_VAR="my value"
export ANOTHER_VAR="another value"
Now you can run serge as follows:
source /var/env/variables && serge /path/to/config.serge
(or use a wrapper script for serge
).
Now you can use %ENV:MY_VAR%
and %ENV:ANOTHER_VAR%
in your Serge configs.
That's neat!
You'd still have to restart the process, but I guess that's a different issue. 😉
Thank you!
You won't need to restart any processes explicitly: Serge will pick up the new values on each run if you use either of the approaches I suggested. Serge is not a server and doesn't persist in memory, after all.
You're absolutely right! 👍
Hi.
Continuing the discussion from https://github.com/iafan/Config-Neat/issues/5, I'd like to be able to substitute variables in the configuration file from values in another file and not values in environment variables.
Having values in a file would allow me to compare values using a file diff utility for example. Otherwise I would have to first make a call on the remote machine to get the value of an environment variable, for the same user account serge is running in if it's a user specific environment variable, and for each environment variable. In order to push updates to different machines I would have to make one or more calls on the remote machine to update one or more environment variables, and then probably restart the process so it can pick up the new values. Where-as if the values are in a file, I could just copy the file to the machine, like when there are updates to the main configuration file.
Thank you.