Skip to content

Environment Variables

Trenton Young edited this page Aug 20, 2024 · 1 revision

Overview

Environment variables are an important tool that Paths make use of to share information between Modules and Tools alike. These variables (often simply called "env vars") can come from a lot of places, so we won't try to define all the sources of this info; rathe, we will just concern ourselves with the parts of Golden-Paths that make use of them.

.env Files

For each (if any) file specified in the env_file option of a Starterfile, Golden-Paths will load all env vars defined within.

After the Path is opened (e.g. after all init_options have been set), if a file is specified in the env_dump option of a Starterfile, all the environment variables that were CREATED (i.e. did not exist before running the CLI) while opening the Path will be written to it.

Replacement

Note

The format ${KEY} is used consistently throughout Golden-Paths.

There are many places within a Path that text may be directly substituted by env vars. The following is an overall example:

The environment variables are as follows:

  • ONE=1
  • FRUIT=apple

The file before replacement is:

${NAME} would like to purchase ${ONE} ${FRUIT}.

The file AFTER replacement would be:

${NAME} would like to purchase 1 apple.

Important

Note that ${NAME} remains unchanged, this is because no such env var is defined so the text remains unchanged.

  • While a Starterfile is being parsed, dest, name, source, and all scripts will have replacement performed.
  • The option env_replace defines a list of files that will have replacement performed after the Path is opened (e.g. after all init_options have been set).
Clone this wiki locally