The env store type enables Spice to read secrets from environment variables and any .env.local or .env files in the project directory. This is the default secret store and is loaded automatically as:
Reference secrets directly in parameters using the syntax ${env:MY_ENV_VAR}. This will load the value of the environment variable MY_ENV_VAR into the parameter.
Example:
The ${} replacement syntax also works within a larger string, like a connection string:
When used with the ${secrets:<my_key>} syntax, the <my_key> variable is UPPERCASED to follow the convention of environment variables.
Example:
The env secret store reads secrets from any .env.local or .env files in the project directory. The .env.local file takes precedence over the .env file. This enables defining template secrets in the .env file which can be checked into source control and overriding them with local secrets in the .env.local file.
Example .env file:
To load environment variables from a specific .env file, use the file_path parameter. When a file_path parameter is specified, environment variables from .env or .env.local will not be loaded.
To continue loading .env or .env.local, specify them as additional secret stores: