-
Notifications
You must be signed in to change notification settings - Fork 0
Usage
Navigate to a project that contains one or many .env
files, then type:
nvi <flag> <arg>
All flags below are optional with the exception that at least one of these flags must be defined:
- config flag
- print flag
- an api flag
- system commands
Only long form (--
) flags are supported.
flag | flag description |
---|---|
—-api |
Specifies whether or not to retrieve ENVs from the nvi API. (ex: --api) |
--config |
Specifies which environment config to load from the nvi.toml file. (ex: --config dev)‡ |
--debug |
Specifies whether or not to log debug details. (ex: --debug) |
--directory |
Specifies which directory the .env files are located within. (ex: --directory path/to/envs) |
--environment |
Specifies which environment config to use within a nvi API project. (ex: --environment dev)‡‡ |
--files |
Specifies which .env files to parse separated by a space. (ex: --files test.env test2.env) |
--project |
Specifies which remote project to select from the nvi API. (ex: --project my_project)‡‡ |
--print |
Specifies whether or not to print ENVs as envs /ENVs , flags , or json /JSON to stdout after parsing. (ex: --print json) |
--required |
Specifies which ENV keys are required separated by a space. (ex: --required KEY1 KEY2) |
--save |
Specifies whether or not to save nvi API ENVs to disk with the selected environment name. (ex: --save)‡‡ |
--help |
Displays condensed help information. (ex: --help) |
--version |
Displays app version. (ex: --version) |
-- |
Specifies which system command to run in a child process with parsed ENVs. (ex: -- cargo run)‡‡‡ |
‡ When a "--config" flag is present, then all the other flags are ignored as they should be defined within a configuration file.
‡‡ When retrieving and saving remote ENVs from the nvi API, the "api" flag must be defined while the "project" and "environment" flags are optional (this will prompt for available selections).
‡‡‡ The "--" (execute) flag needs be the last defined flag. It will also override the "print" flag and any flags after it will be consumed as part of the system command.
Instead of manually typing out flags and arguments in the CLI, you can place them in a nvi.toml
configuration file.
The configuration file is a TOML file that contains...
- An
[environment]
name that defines the following optional properties:-
api: boolean (default:
false
) -
debug: boolean (default:
false
) -
directory: string (default:
""
) -
environment: string (default:
""
) -
execute: string[] (default:
[]
) -
files: string[] (default
[".env"]
) -
print: string (
envs
|ENVs
,flags
, orjson
|JSON
) (default:""
) -
project: string (default:
""
) -
required: string[] (default
[]
) -
save: boolean (default
false
)
-
api: boolean (default:
The following represents an example nvi.toml
configuration:
[dev]
debug = true
directory = "path/to/custom/dir"
files = [ ".env", "base.env", "reference.env" ]
execute = [ "bin", "arg1", "arg2" ]
required = [ "TEST1", "TEST2", "TEST3" ]
[staging]
files = [ ".env" ]
required = [ "TEST1" ]
print = "envs"
[remote_dev]
api = true
debug = true
environment = "development"
execute = [ "bin", "arg1" ]
project = "my_project"
required = [ "TEST1", "TEST2", "TEST3" ]
save = true
To target a configuration within the nvi.toml config file, simply use the --config
flag followed by the config name:
nvi --config staging
Please read this for config file specs.