Move remote API config out of daemon/

Signed-off-by: Solomon Hykes <solomon@docker.com>
This commit is contained in:
Solomon Hykes
2014-08-13 19:25:51 +00:00
parent 1eba59eb24
commit 1d10c55aec
10 changed files with 11 additions and 20 deletions
+1 -2
View File
@@ -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
View File
@@ -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
View File
@@ -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.")
}