Environment
Default environment variables
lets has builtin environ variables which user can override before lets execution. E.g LETS_DEBUG=1 lets test
LETS_DEBUG- enable debug messagesLETS_CONFIG- changes defaultlets.yamlfile path (e.g. LETS_CONFIG=lets.my.yaml)LETS_CONFIG_DIR- changes path to dir wherelets.yamlfile placedLETS_CHECK_UPDATE- disables background update checks and notificationsNO_COLOR- disables colored output. See https://no-color.org/
Environment variables available at command runtime
LETS_COMMAND_NAME- string name of launched commandLETS_COMMAND_ARGS- positional arguments for launched command, e.g. forlets run --debug --config=test.iniit will contain--debug --config=test.iniLETS_COMMAND_WORK_DIR- absolute path towork_dirspecified in command.LETS_CONFIG- absolute path to lets config file.LETS_CONFIG_DIR- absolute path to lets config file firectory.LETS_OS- current operating system name from Go runtime, for examplelinux,darwin,windowsLETS_ARCH- current architecture name from Go runtime, for exampleamd64,arm64,386LETS_SHELL- shell from config or command.LETSOPT_<>- options parsed from commandoptions(docopt string). E.glets run --env=prod --reloadwill beLETSOPT_ENV=prodandLETSOPT_RELOAD=trueLETSCLI_<>- options which values is a options usage. E.glets run --env=prod --reloadwill beLETSCLI_ENV=--env=prodandLETSCLI_RELOAD=--reload
Override command env with -E flag
env_file precedence
env_file loads dotenv-style files from config and command definitions.
Precedence order is:
- process env
- builtin lets vars
- global
env - global
env_file - command
env - command
env_file - command options,
-E/--env, checksum vars
When the same key is present in both directives, env_file wins over env at the same scope.
env_file file names are expanded after env is resolved. This means:
- global
env_filecan depend on globalenv - command
env_filecan depend on merged global env and commandenv env.shstill does not read values fromenv_file
You can override environment for command with -E flag:
shell: bash
commands:
say:
env:
NAME: Rick
cmd: echo Hello ${NAME}
lets say - prints Hello Rick
lets -E NAME=Morty say - prints Hello Morty
Alternatively:
lets --env NAME=Morty say - prints Hello Morty