mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
api: add Hosts to API Config
This makes the API configuration more self-contained. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -639,6 +639,7 @@ func newAPIServerConfig(config *config.Config) (*apiserver.Config, error) {
|
||||
Version: dockerversion.Version,
|
||||
CorsHeaders: config.CorsHeaders,
|
||||
TLSConfig: tlsConfig,
|
||||
Hosts: config.Hosts,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -668,14 +669,14 @@ func checkTLSAuthOK(c *config.Config) bool {
|
||||
}
|
||||
|
||||
func loadListeners(cli *DaemonCli, serverConfig *apiserver.Config) ([]string, error) {
|
||||
if len(cli.Config.Hosts) == 0 {
|
||||
if len(serverConfig.Hosts) == 0 {
|
||||
return nil, errors.New("no hosts configured")
|
||||
}
|
||||
var hosts []string
|
||||
|
||||
for i := 0; i < len(cli.Config.Hosts); i++ {
|
||||
protoAddr := cli.Config.Hosts[i]
|
||||
protoAddrParts := strings.SplitN(cli.Config.Hosts[i], "://", 2)
|
||||
for i := 0; i < len(serverConfig.Hosts); i++ {
|
||||
protoAddr := serverConfig.Hosts[i]
|
||||
protoAddrParts := strings.SplitN(serverConfig.Hosts[i], "://", 2)
|
||||
if len(protoAddrParts) != 2 {
|
||||
return nil, fmt.Errorf("bad format %s, expected PROTO://ADDR", protoAddr)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user