This module exposes commands to interact with .env files. In addition to
parsing them, this module can load them into your environment (automatically or
manually).
use dotenv.nu *
dotenv loadParsing:
dotenv parse [file] # Parse a dotenv file
dotenv parse tree [file] # Recursively parse dotenv files
dotenv collect # Collect parsed dotenv files into a single record
# You can manually load all variables defined in a dotenv file with:
dotenv parse | dotenv collect | load-env
# You can also use the `from env` command
"x=1" | from env
# which also allows parsing files that end in .env
open .envLoading:
dotenv load [file] # Load a dotenv file into $env
dotenv load tree [file] # Recursively load dotenv files into $env
dotenv autoenv enable # Automatically load dotenv files into $env
dotenv autoenv disable # Disable autoenvClone this repository, then import it with use dotenv.nu *:
git clone --depth=1 https://github.com/TehPers/dotenv.nu
use dotenv.nu *A good place to import this repository is into a library directory. Check the
value of $NU_LIB_DIRS to see which directories are library directories. If
cloned into a library directory, you can use dotenv.nu * from any directory.
If you don't want to run use dotenv.nu * in every session before using the
dotenv commands, then add use dotenv.nu * to your config. Run config nu to
edit the config.
You can upgrade or downgrade at any time from within the cloned repository using
standard git commands:
cd dotenv.nu
git pullUninstall by deleting the cloned repository. If you modified your config to load this module, then revert the relevant changes.
See LICENSE for the full license.