Extends the Piral CLI command options to automatically include dotenv files.
npm install piral-cli-dotenv!Azure Build Status !GitHub License
Plugin for the piral-cli. Adds a flag to include environment variables from .env files.
Extends the Piral CLI command options to include dotenv files.
Install the plugin either locally or globally.
We recommend the local installation:
``sh`
npm i piral-cli-dotenv --save-dev
Some commands of the Piral CLI will be extended with --env flags, e.g.,
`sh`
piral debug
The list of supported / extended commands is:
- build-piraldebug-piral
- validate-piral
- build-pilet
- debug-pilet
- publish-pilet
- validate-pilet
-
The --env flags behave as follows.
#### No argument
Standard dotenv resolution mechanism, e.g., takes a .env file if available.
Example Call:
`sh`
piral build
#### File path
Uses the path to resolve and use the file as dotenv input.
Example input:
`plain`
./secrets/.env
Example call:
`sh`
piral build
#### Name
Uses a file {name}.env or .env.{name} as input for dotenv.
Example input:
`plain`
prod
Example call:
`sh`
piral build
#### Variables
Uses the provided values as environment variables.
Example inputs:
`plain`
FOO=BAR
FOO="BAR";BAR="FOO"
Example call:
`sh`
piral build
Yes.
Yes. Some variables are special (e.g., NODE_ENV) and will be set by the piral-cli` anyway. This plugin focuses on non-special variables.
This plugin is released using the MIT license. For more information see the LICENSE file.