See the readme.
This variable is exported and holds the configuration for the entire module. You cannot remove or replace it (without force) but you can modify its properties, which take effect immediately.
For example, instead of running Disable-Dotenv
, you can run $Dotenv.Enabled = $false
.
The $Dotenv
variable is how you configure the modules behaviour.
These are its fields:
Enabled
: Turns the module on and off.LoggingPreference
: Configures how the logs are written, you can tab through its fields.Parallel
: If set to true, everytimeUpdate-Dotenv
is called, it will be done in a new thread therefore will not block.Names
: Controls which names are considered env files. You should either call its methodsAddName()
andRemoveName()
or use the cmdletsRegister-DotenvName
andUnregister-DotenvName
.SkipErrors
: If set to true, errors encountered during parsing env files will cause the parser to skip to the next line instead of returning.SafeMode
: If enabled, only the files explicitly allowed will be sourced.Quiet
: If set to$true
, disables info messages while the safe mode is enabled and there are unauthorized files in the current directory or its parents.AuthorizedPatterns
: A read-only list containing the patterns you whitelisted.
Parses an env file. The parsed variables are not sourced, the caller is expected to do it. You don't have to call this command, the module uses it under the hood.
Disables the module without removing it from the session. Equivalent to $Dotenv.Enabled = $true
.
Enables the module back. Equivalent to $Dotenv.Enabled = $true
.
Triggers the module to check for env files in the current and parent directories. This is the entrypoint to this module. This command is meant to be called automatically by your Prompt
function.
Whitelists a directory for dotenv. Every existing and future env files under the directory (recursively) will be allowed. This only has an effect with the safe mode enabled.
Whitelists a particular env file for dotenv. This only has an effect with the safe mode enabled. With the safe mode, files not explicitly allowed by you will not be sourced.
Removes a file from the list of authorized files. This only has an effect with the safe mode enabled. With the safe mode, files not explicitly allowed by you will not be sourced.
Adds a new name to the list of env file names this module will check for. Equivalent to $Dotenv.AddName()
.
Removes a name from the list of names this module will consider as an env file. Equivalent to $Dotenv.RemoveName()
.
Adds a glob pattern to the whitelist. This only has an effect with the safe mode enabled.
Removes an entry from the Dotenv whitelist. This only has an effect with the safe mode enabled.