DotEnv


Follow
0
Star
0
Details
Releases
Issues
This application is not supported by InterSystems Corporation. Use it at your own risk.

What's new in this version

Initial Release

Load environment variables from .dotenv files or straight from the OS to Caché

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.

Category
Developer Environment
Works with
InterSystems IRISInterSystems IRIS for HealthCachéEnsemble
Tags
Info
Version
1.0.0
Last updated
2020-07-29
Repository
Open
Documentation
Open
License
Link