fix(compute/serve): allow overriding of viceroy binary #859
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.
Fixes #828 #858
Problem
The
compute serve
subcommand requires Viceroy to be installed but some users have had problems with the Fastly CLI handling the downloading of the required Viceroy binary 'out-of-band'.Examples of this are:
Solution
To solve this issue the user needs to be able to have the Fastly CLI use a version of the Viceroy binary that they have installed separately from the CLI (e.g. as part of a CI pipeline the user would manually install Viceroy, then install/run the Fastly CLI and inform it of where the Viceroy binary exists).
This PR introduces two new behaviours...
--viceroy-path
flag.FASTLY_VICEROY_USE_PATH
environment variable.--viceroy-path
A new
--viceroy-path=<PATH_TO_VICEROY_BINARY>
flag on thecompute serve
subcommand.If set the Fastly CLI will use the version of the
viceroy
binary that the given path references.If the
--verbose
flag is set, then the CLI will display the following INFO log output:FASTLY_VICEROY_USE_PATH
If the environment variable
FASTLY_VICEROY_USE_PATH
is set to either1
,true
orTRUE
then the CLI will attempt to lookup theviceroy
binary from the user's$PATH
.If passing the
--verbose
flag (and the binary exists in the user's PATH), then you'll see an INFO log indicating where theviceroy
binary is being sourced from.