mirror of
https://github.com/status-im/consul.git
synced 2025-01-10 22:06:20 +00:00
Allow internal watches to use https and unix sockets
This commit is contained in:
parent
a7a6ee9f4c
commit
9e23dabbfa
@ -1082,7 +1082,13 @@ func (c *Command) Run(args []string) int {
|
||||
}
|
||||
|
||||
// Get the new client http listener addr
|
||||
httpAddr, err := config.ClientListener(config.Addresses.HTTP, config.Ports.HTTP)
|
||||
var httpAddr net.Addr
|
||||
var err error
|
||||
if config.Ports.HTTP != -1 {
|
||||
httpAddr, err = config.ClientListener(config.Addresses.HTTP, config.Ports.HTTP)
|
||||
} else {
|
||||
httpAddr, err = config.ClientListener(config.Addresses.HTTPS, config.Ports.HTTPS)
|
||||
}
|
||||
if err != nil {
|
||||
c.Ui.Error(fmt.Sprintf("Failed to determine HTTP address: %v", err))
|
||||
}
|
||||
@ -1092,7 +1098,12 @@ func (c *Command) Run(args []string) int {
|
||||
go func(wp *watch.WatchPlan) {
|
||||
wp.Handler = makeWatchHandler(logOutput, wp.Exempt["handler"])
|
||||
wp.LogOutput = c.logOutput
|
||||
if err := wp.Run(httpAddr.String()); err != nil {
|
||||
addr := httpAddr.String()
|
||||
// If it's a unix socket, prefix with unix:// so the client initializes correctly
|
||||
if httpAddr.Network() == "unix" {
|
||||
addr = "unix://" + addr
|
||||
}
|
||||
if err := wp.Run(addr); err != nil {
|
||||
c.Ui.Error(fmt.Sprintf("Error running watch: %v", err))
|
||||
}
|
||||
}(wp)
|
||||
|
Loading…
x
Reference in New Issue
Block a user