© 2025 InterSystems Corporation, Cambridge, MA. All rights reserved.Privacy & TermsGuaranteeSection 508Contest Terms
Initial Release
Almost every language has dotenv. So why not Caché?
Add the capability of reading environment variables from a .env file or straight from your running OS.
The easiest way is to simply import the released XML from here
Quick and easy:
##class(DotEnv.Parser).FromOS()##class(DotEnv.Parser).FromPath("path/to/file", .status, ".env-prod")Each method returns an %ArrayOfDataTypes instance populated with your env variables.
NOTE: When using
FromPath, any of the existing ones won’t be overwritten. Do NOT include the file name when passing the path to this method. Use the third parameter for that instead: (path, status code, file name). The default file name is.env.
.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.
MIT.