Open aadamsx opened 3 years ago
This is a neat idea, and I don't mind looking into this, as this follows the general logic to enable some Shell
functionality to those .env
files. Obviously, not all functionality — but the ability to re–use variables is definitely worth considering:
BASE=/var/log/program
COMPONENT_LOG="${BASE}/component.log"
SERVER_LOG="${BASE}/server.log"
something along these lines
Typically .env these files are small and manageable, but there are times when you run into situations where you duplicate the same data within the file. Here is an example:
MAIL_USERNAME=hello@laravel-news.com MAIL_FROM_ADDRESS=hello@laravel-news.com
The dotenv package that Laravel relies on can use variables with other defined variables in this same file. For example:
MAIL_USERNAME=hello@laravel-news.com MAIL_FROM_ADDRESS=${MAIL_USERNAME}
This simple trick allows you not to repeat yourself and can be useful when you have multiple services requiring the same piece of data.
I tried using this with the deno dotenv package and the engine doesn't pick up the variable, intead the console log value in the MAIL_FROM_ADDRESS example above would be ${MAIL_USERNAME} instead of hello@laravel-news.com.