nanobox evar load command allows you to load environment variables from a single file or multiple files.
# Pattern nanobox evar load <local | dry-run | remote> path/to/file nanobox evar load <local | dry-run | remote> path/to/file1 path/to/file2 # Examples nanobox evar load config/evars nanobox evar load local config/evars1 config/evars2 .env
Environment Variable Files
Loaded files should consist of key-value pairs associated with an equals sign
=. Values containing spaces or special characters should be wrapped in double quotes
"". Below is an example file showing supported key-value formats.
key=value key="value" key="this is a multiline value" key=" another multiline value surrounded by whitespace " key="yes, even spaces and = are allowed as values" export key=value export key="you're welcome ;)"
exports and whitespace between key-value pairs don't matter. They get stripped out as the file is read in and variables are installed.
Loading environment variables from a file can be really handy in certain cases. Here's just a few.
Bulk Import of Environment Variables
Some projects require a number of environment variables in order to function properly. Including all the necessary key-value pairs in a single file lets you load them all at once rather than having to build out a huge comma/space delimited list of key-value pairs to pass into the
nanobox evar add command.
Some projects require environment variables with multi-line values. Adding these isn't possible using just the
nanobox evar add command, but include the key-value pair in a file allows you to load them in with the
nanobox evar load command.
Values with Spaces or Special Characters
nanobox evar add command splits on spaces/commas and uses
= to define key-value pairs. Environment variables that include these characters and other special characters can't be added using the
evar add command. Loading the environment variables from a file gets around these restrictions with some documented formatting caveats.
Subscribe to Nanobox News
Get the latest posts delivered right to your inbox