Home Applications DotEnv

DotEnv

This application is not supported by InterSystems Corporation. Please be notified that you use it at your own risk.
4.5
1 reviews
0
Awards
104
Views
0
IPM installs
0
1
Details
Releases
Reviews  (1)
Issues
Load environment variables from .dotenv files or straight from the OS to Caché

What's new in this version

Initial Release

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.

Version
1.0.029 Jul, 2020
Category
Developer Environment
Works with
CachéEnsembleInterSystems IRISInterSystems IRIS for Health
First published
29 Jul, 2020
Last checked by moderator
26 Mar, 2024Works