Skip to content
/ dotenv Public

Load environment variables from .env files or from the OS to Caché/IRIS.

License

Notifications You must be signed in to change notification settings

rfns/dotenv

Repository files navigation

dotenv

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.

Installing

The easiest way is to simply import the released XML from here

Usage

Quick and easy:

  • If you want to read from your OS use ##class(DotEnv.Parser).FromOS()
  • If you want to read from a file use ##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.

Format

.env files should be composed using the following format:

YOUR_VARIABLE="your value"
YOUR_NUMBER=1337
WHATEVER="you want, it\'s also \nescaped"

CONTRIBUTING

Got some idea? Follow this guide.

LICENSE

MIT.