Environment variables
environment-variables.Rmd
Project initialisation
The environment variables make custom setup of the project easier.
Name | Value(s) | Action | |
---|---|---|---|
PROJR_PATH_YML |
<path> |
Use file at <path> instead of default
_projr.yml
|
|
PROJR_FIRST_NAME |
<name> |
Offer <name> as first name option |
|
PROJR_LAST_NAME |
<name> |
Offer <name> as last name option |
|
PROJR_EMAIL |
<email> |
Offer <email> as email option |
|
PROJR_GITHUB_USER_NAME |
<username> |
Offer <username> as GitHub username option |
If set, PROJR_PATH_YML
specifies the default location
for the _projr.yml
file. It may be overriden in
projr_init
by setting the yml_path_from
parameter. If neither are specified, the default _projr.yml
file is used.
The remaining environment variables are used to pre-populate the interactive setup prompts. If set, the user will be given these as options, but may choose to manually enter an option instead. Multiple options may be provided by placing a semi-colon between them, e.g. “John;JohnnyBoy” yields two options: “John” and “JohnnyBoy”.
Project builds
During projr
builds, projr
mimicks the
treatment of environment variables by Quarto
projects.
Various files, prefixed with _environment
, specify default
values for environment variables that are used if the variables are not
already set. Any variables not originally set are unset after the
build.
Environment files are searched for in the following order:
-
_environment.local
- Intended to store user-specific, and possibly private, environment variables, such as access tokens.
- This file should not be checked into Git, and is automatically
ignored by
projr
.
-
_environment.<QUARTO_PROFILE>
, whereQUARTO_PROFILE
is the value of theQUARTO_PROFILE
environment variable- Intended to store environment variables specific to a particular profile.
- If
QUARTO_PROFILE
contains commas, then the strings between commas are treated as separate profiles loaded in the order found inQUARTO_PROFILE
.
-
_environment
- Intended to store environment variables common to all profiles.
In addition, if an _environment.required
file is set,
then the environment variables specified inside are checked for
existence. If they are not set, warnings are printed (but the build is
not aborted).