mirror of
https://github.com/clearlinux/docker.git
synced 2026-09-07 22:42:09 +00:00
Move remote API config out of daemon/
Signed-off-by: Solomon Hykes <solomon@docker.com>
This commit is contained in:
+1
-2
@@ -63,8 +63,7 @@ func mainDaemon() {
|
||||
)
|
||||
|
||||
// Serve api
|
||||
// FIXME: 'Sockets' should not be part of daemon.Config
|
||||
job := eng.Job("serveapi", daemonCfg.Sockets...)
|
||||
job := eng.Job("serveapi", flHosts...)
|
||||
job.SetenvBool("Logging", true)
|
||||
job.SetenvBool("EnableCors", *flEnableCors)
|
||||
job.Setenv("Version", dockerversion.VERSION)
|
||||
|
||||
+4
-4
@@ -38,7 +38,7 @@ func main() {
|
||||
os.Setenv("DEBUG", "1")
|
||||
}
|
||||
|
||||
if len(daemonCfg.Sockets) == 0 {
|
||||
if len(flHosts) == 0 {
|
||||
defaultHost := os.Getenv("DOCKER_HOST")
|
||||
if defaultHost == "" || *flDaemon {
|
||||
// If we do not have a host, default to unix socket
|
||||
@@ -47,7 +47,7 @@ func main() {
|
||||
if _, err := api.ValidateHost(defaultHost); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
daemonCfg.Sockets = append(daemonCfg.Sockets, defaultHost)
|
||||
flHosts = append(flHosts, defaultHost)
|
||||
}
|
||||
|
||||
if *flDaemon {
|
||||
@@ -55,10 +55,10 @@ func main() {
|
||||
return
|
||||
}
|
||||
|
||||
if len(daemonCfg.Sockets) > 1 {
|
||||
if len(flHosts) > 1 {
|
||||
log.Fatal("Please specify only one -H")
|
||||
}
|
||||
protoAddrParts := strings.SplitN(daemonCfg.Sockets[0], "://", 2)
|
||||
protoAddrParts := strings.SplitN(flHosts[0], "://", 2)
|
||||
|
||||
var (
|
||||
cli *client.DockerCli
|
||||
|
||||
+6
-3
@@ -4,6 +4,7 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/docker/docker/opts"
|
||||
flag "github.com/docker/docker/pkg/mflag"
|
||||
)
|
||||
|
||||
@@ -27,13 +28,15 @@ var (
|
||||
flTlsVerify = flag.Bool([]string{"-tlsverify"}, false, "Use TLS and verify the remote (daemon: verify client, client: verify daemon)")
|
||||
|
||||
// these are initialized in init() below since their default values depend on dockerCertPath which isn't fully initialized until init() runs
|
||||
flCa *string
|
||||
flCert *string
|
||||
flKey *string
|
||||
flCa *string
|
||||
flCert *string
|
||||
flKey *string
|
||||
flHosts []string
|
||||
)
|
||||
|
||||
func init() {
|
||||
flCa = flag.String([]string{"-tlscacert"}, filepath.Join(dockerCertPath, defaultCaFile), "Trust only remotes providing a certificate signed by the CA given here")
|
||||
flCert = flag.String([]string{"-tlscert"}, filepath.Join(dockerCertPath, defaultCertFile), "Path to TLS certificate file")
|
||||
flKey = flag.String([]string{"-tlskey"}, filepath.Join(dockerCertPath, defaultKeyFile), "Path to TLS key file")
|
||||
opts.HostListVar(&flHosts, []string{"H", "-host"}, "The socket(s) to bind to in daemon mode\nspecified using one or more tcp://host:port, unix:///path/to/socket, fd://* or fd://socketfd.")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user