Almost every language has dotenv. So why not Caché?
Add the capability of reading environment variables from a .dotenv file or straight from your running OS.
The easiest way is to simply import the dotenv.xml provided.
Quick and easy:
- If you want to read from your OS use
- If you want to read from a file use
Each method returns an %ArrayOfDataTypes instance populated with your env variables. When using
FromPath, existing ones aren't overwritten.
.env files should be composed using the following format:
YOUR_VARIABLE="your value" YOUR_NUMBER=1337 WHATEVER="you want, it\'s also \nescaped"
Got some idea? Follow this guide.
If you want to run those tests you must have Port installed since it uses a different mechanism for running them straight from your repository folder.