Question
· Jul 11, 2017

dotenv: Read enviroment variables from a .dotenv or straight from your OS

You might find it useful or not. It depends on what you can imagine it to be used with, like I had to.

Either way, I created a lib that can fetch environment variables from a file or from the OS where Caché is running.

Mostly know as dotenv. Many languages have it, so why not Caché?

The usage is pretty simple:

If you want to use OS env vars exclusively, just use the method:

##class(DotEnv.Parser).FromOS()

Otherwise, if you want to specify a .env file containing your variables to complement the OS ones use the method:

##class(DotEnv.Parser).FromPath("/path/to/file")

Both methods return an %ArrayOfDataTypes containing the env variables.

Discussion (3)0
Log in or sign up to continue