-
Notifications
You must be signed in to change notification settings - Fork 329
cli: pass raw string of server run
flags to install command
#2328
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't accept them as a string, because then we need to do shell splitting which is non-trivial to do. I noted some places in the PR where I expect it just doesn't work either if more than one argument is provided.
I would propose changing this to using --
as a breakpoint to start treating everything after that (the []string
) as args to append onto the args list instead.
There are libraries to do shell splitting but the reason I generally don't recommend it is because I've done it at significant user-adoption-scale before with Vagrant and Packer and its a constant cat-and-mouse of edge cases to chase down. That's why I recommend anything that does subprocessing to force the user to enter it as a slice of arg strings rather than a shell string.
So my recommendation is to allow the user to do:
$ waypoint server install -platform=whatever -- -v -db=/foo
And the -v
and -db=/foo
get chosen out as the server flags. This is an idiomatic Unix-ism used by tools such as xargs
which subprocess out to additional child processes, so this isn't some weird bespoke UX thing.
It'd be fairly easy to preprocess the args []string
parameter on the install command to split by the first --
it sees, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌🏻 nice! Love all the various website/docs fixups you found in this too. I didn't try to install on every single platform, but overall the PR looks good to me from a code perspective 🎉
This allows users to pass flags "through" the
install
command to theserver run
command that all server install platforms use. Included inupgrade
as well for Nomad and Docker.There are a couple typos and doc updates for various items as well that I saw while moving around the install/run docs.
Fixes #1514
Fixes #1491
Augments #2325 by allowing the user to set their server log levels on an install.
To test:
Base case:
main
, runmake
, then use the built binary to install the Waypoint server on docker. Check out the logs (docker logs waypoint-server
) and observe that there areINFO
andDEBUG
logs only.Test case:
make
, then use the built binary to install the Waypoint server on docker as follows:waypoint install -platform=docker -accept-tos -- -vvv
. Check out the logs again, and observe there are nowTRACE
logs as well.