feat: support --env option for the runtime build #1090
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds a new
--env
option to the CLI which can be used to specify and define environment variables at build time.Passing
--env A,B,C
will make these environment variables get built into the runtime. A warning message will display in the console making it clear that these environment variables are being built into the application:Passing
--env A=alpha,B=bravo,C
will set the environment variables forA
andB
as the strings"alpha"
and"bravo"
, but then still warn thatC
is being written in from the ambient environment:In the runtime itself,
fastly:env
will now default to reading these values when set, and only then fall back to environment variables provided by the edge runtime such asFASTLY_HOSTNAME
. Initialization environment variables thus override the runtime ones.Note: There is no option to build in every environment variable from the outer environment, as this would be insecure.
Resolves #1089.