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 servesubcommand 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-pathflag.FASTLY_VICEROY_USE_PATHenvironment variable.--viceroy-path
A new
--viceroy-path=<PATH_TO_VICEROY_BINARY>flag on thecompute servesubcommand.If set the Fastly CLI will use the version of the
viceroybinary that the given path references.If the
--verboseflag is set, then the CLI will display the following INFO log output:FASTLY_VICEROY_USE_PATH
If the environment variable
FASTLY_VICEROY_USE_PATHis set to either1,trueorTRUEthen the CLI will attempt to lookup theviceroybinary from the user's$PATH.If passing the
--verboseflag (and the binary exists in the user's PATH), then you'll see an INFO log indicating where theviceroybinary is being sourced from.