Add public address config option (#405)

This commit is contained in:
Jeff Mitchell authored and GitHub committed 2020-09-22 08:28:10 -04:00
1 parent 475c6cdebe
commit 262ff06042
7 files changed
+92 -25

No files matched your search

+28
View File
@@ -34,6 +34,8 @@ type Command struct {
flagDevAuthMethodId string
flagDevControllerAPIListenAddr string
flagDevControllerClusterListenAddr string
flagDevWorkerProxyListenAddr string
flagDevWorkerPublicAddr string
flagDevSkipAuthMethodCreation bool
flagDevDisableDatabaseDestruction bool
}
@@ -119,6 +121,20 @@ func (c *Command) Flags() *base.FlagSets {
Usage: "Address to bind to for controller \"cluster\" purpose.",
})
f.StringVar(&base.StringVar{
Name: "dev-proxy-listen-address",
Target: &c.flagDevWorkerProxyListenAddr,
EnvVar: "BOUNDARY_DEV_WORKER_PROXY_LISTEN_ADDRESS",
Usage: "Address to bind to for worker \"proxy\" purpose.",
})
f.StringVar(&base.StringVar{
Name: "dev-worker-public-address",
Target: &c.flagDevWorkerPublicAddr,
EnvVar: "BOUNDARY_DEV_WORKER_PUBLIC_ADDRESS",
Usage: "Public address at which the worker is reachable for session proxying.",
})
f.BoolVar(&base.BoolVar{
Name: "dev-skip-auth-method-creation",
Target: &c.flagDevSkipAuthMethodCreation,
@@ -204,6 +220,11 @@ func (c *Command) Run(args []string) int {
if c.flagDevControllerClusterListenAddr != "" {
l.Address = c.flagDevControllerClusterListenAddr
}
case "proxy":
if c.flagDevWorkerProxyListenAddr != "" {
l.Address = c.flagDevWorkerProxyListenAddr
}
}
}
@@ -247,6 +268,13 @@ func (c *Command) Run(args []string) int {
return 1
}
if err := c.SetupWorkerPublicAddress(devConfig, c.flagDevWorkerPublicAddr); err != nil {
c.UI.Error(err.Error())
return 1
}
c.InfoKeys = append(c.InfoKeys, "worker public addr")
c.Info["worker public addr"] = devConfig.Worker.PublicAddr
// Write out the PID to the file now that server has successfully started
if err := c.StorePidFile(devConfig.PidFile); err != nil {
c.UI.Error(fmt.Errorf("Error storing PID: %w", err).Error())