Add a passthrough directory feature. (#76)

This is only compiled in when a `dev` build tag is specified (see #75)
for safety. Attempting to use the flag without that tag at build time
will fail. However, it is always available within the codebase itself so
that tests can be written against this functionality in a programmatic
way.

Manual testing was performed; no plans to add automated ones as this
isn't production-necessary nor exported functionality.
This commit is contained in:
Jeff Mitchell authored and GitHub committed 2020-05-21 16:12:31 -04:00
1 parent 9fd86faf15
commit 374a3991a2
7 files changed
+88 -30

No files matched your search

@@ -0,0 +1,18 @@
// +build dev
package controller
import "github.com/hashicorp/watchtower/internal/cmd/base"
func init() {
devOnlyControllerFlags = addDevOnlyControllerFlags
}
func addDevOnlyControllerFlags(c *Command, f *base.FlagSet) {
f.StringVar(&base.StringVar{
Name: "dev-passthrough-directory",
Target: &c.flagDevPassthroughDirectory,
EnvVar: "WATCHTOWER_DEV_PASSTHROUGH_DIRECTORY",
Usage: "Enables a passthrough directory in the webserver at /passthrough",
})
}