1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Move daemon config into sub pkg

Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
This commit is contained in:
Michael Crosby 2014-03-07 15:22:23 -08:00
parent d9f47c41c3
commit 12bd83182d
3 changed files with 11 additions and 9 deletions

View file

@ -1,4 +1,4 @@
package docker
package daemonconfig
import (
"net"
@ -13,7 +13,7 @@ const (
)
// FIXME: separate runtime configuration from http api configuration
type DaemonConfig struct {
type Config struct {
Pidfile string
Root string
AutoRestart bool
@ -32,8 +32,8 @@ type DaemonConfig struct {
// ConfigFromJob creates and returns a new DaemonConfig object
// by parsing the contents of a job's environment.
func DaemonConfigFromJob(job *engine.Job) *DaemonConfig {
config := &DaemonConfig{
func ConfigFromJob(job *engine.Job) *Config {
config := &Config{
Pidfile: job.Getenv("Pidfile"),
Root: job.Getenv("Root"),
AutoRestart: job.GetenvBool("AutoRestart"),

View file

@ -4,6 +4,7 @@ import (
"container/list"
"fmt"
"github.com/dotcloud/docker/archive"
"github.com/dotcloud/docker/daemonconfig"
"github.com/dotcloud/docker/dockerversion"
"github.com/dotcloud/docker/engine"
"github.com/dotcloud/docker/execdriver"
@ -53,7 +54,7 @@ type Runtime struct {
volumes *Graph
srv *Server
eng *engine.Engine
config *DaemonConfig
config *daemonconfig.Config
containerGraph *graphdb.Database
driver graphdriver.Driver
execDriver execdriver.Driver
@ -624,7 +625,7 @@ func (runtime *Runtime) RegisterLink(parent, child *Container, alias string) err
}
// FIXME: harmonize with NewGraph()
func NewRuntime(config *DaemonConfig, eng *engine.Engine) (*Runtime, error) {
func NewRuntime(config *daemonconfig.Config, eng *engine.Engine) (*Runtime, error) {
runtime, err := NewRuntimeFromDirectory(config, eng)
if err != nil {
return nil, err
@ -632,7 +633,7 @@ func NewRuntime(config *DaemonConfig, eng *engine.Engine) (*Runtime, error) {
return runtime, nil
}
func NewRuntimeFromDirectory(config *DaemonConfig, eng *engine.Engine) (*Runtime, error) {
func NewRuntimeFromDirectory(config *daemonconfig.Config, eng *engine.Engine) (*Runtime, error) {
// Set the default driver
graphdriver.DefaultDriver = config.GraphDriver

View file

@ -5,6 +5,7 @@ import (
"fmt"
"github.com/dotcloud/docker/archive"
"github.com/dotcloud/docker/auth"
"github.com/dotcloud/docker/daemonconfig"
"github.com/dotcloud/docker/dockerversion"
"github.com/dotcloud/docker/engine"
"github.com/dotcloud/docker/pkg/graphdb"
@ -34,7 +35,7 @@ import (
// The signals SIGINT, SIGQUIT and SIGTERM are intercepted for cleanup.
func InitServer(job *engine.Job) engine.Status {
job.Logf("Creating server")
srv, err := NewServer(job.Eng, DaemonConfigFromJob(job))
srv, err := NewServer(job.Eng, daemonconfig.ConfigFromJob(job))
if err != nil {
return job.Error(err)
}
@ -2318,7 +2319,7 @@ func (srv *Server) ContainerCopy(job *engine.Job) engine.Status {
return job.Errorf("No such container: %s", name)
}
func NewServer(eng *engine.Engine, config *DaemonConfig) (*Server, error) {
func NewServer(eng *engine.Engine, config *daemonconfig.Config) (*Server, error) {
runtime, err := NewRuntime(config, eng)
if err != nil {
return nil, err