acryps environment
Environment variable manager for local development
Getting Started
npm install @acryps/environment --save-dev
Active environment by adding environment
before launching your application in your scripts
tsc && node index.js
→ tsc && environment index.js
Define environment variables in your package.json
{
"name": "my-application",
"environment": {
"host": "Application Host",
"database": {
"host": "Database Host",
"+port?5432": "Database Port"
}
}
}
You'll automatically be prompted to enter the values required for your project.
The following environment variables will automatically be passed as environment variables to the application launched by environment:
HOST
DATABASE_HOST
DATABASE_PORT
Access them as usual with process.env.HOST
- no changes to the code required.
Modifiers
Modifiers may be added to the names in the package configuration
…?default
: Set a default value which will be accepted when the user does not provide a value+…
: Require a numeric value
Adding an uppercase letter in the variables name will automatically be expanded with a _
: accessKey
→ ACCESS_KEY
Node Options
Options for node can still be used, just add them before your modules location
node --max-old-space-size=16192 index.js
→ environment --max-old-space-size=16192 index.js
The child program will be executed with the same node as environment (using process.execPath
)