2015-05-15 19:34:26 -04:00
|
|
|
// +build daemon
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2015-12-10 18:35:10 -05:00
|
|
|
"fmt"
|
2015-07-30 15:39:19 -04:00
|
|
|
"os"
|
2015-12-10 18:35:10 -05:00
|
|
|
"syscall"
|
2015-07-30 15:39:19 -04:00
|
|
|
|
2015-12-10 18:35:10 -05:00
|
|
|
"github.com/Sirupsen/logrus"
|
2015-05-15 19:34:26 -04:00
|
|
|
apiserver "github.com/docker/docker/api/server"
|
|
|
|
"github.com/docker/docker/daemon"
|
2015-12-10 18:35:10 -05:00
|
|
|
"github.com/docker/docker/pkg/mflag"
|
|
|
|
"github.com/docker/docker/pkg/system"
|
2015-05-15 19:34:26 -04:00
|
|
|
)
|
|
|
|
|
2015-12-10 18:35:10 -05:00
|
|
|
var defaultDaemonConfigFile = os.Getenv("programdata") + string(os.PathSeparator) + "docker" + string(os.PathSeparator) + "config" + string(os.PathSeparator) + "daemon.json"
|
|
|
|
|
2015-07-21 01:15:44 -04:00
|
|
|
func setPlatformServerConfig(serverConfig *apiserver.Config, daemonCfg *daemon.Config) *apiserver.Config {
|
2015-05-15 19:34:26 -04:00
|
|
|
return serverConfig
|
|
|
|
}
|
|
|
|
|
|
|
|
// currentUserIsOwner checks whether the current user is the owner of the given
|
|
|
|
// file.
|
|
|
|
func currentUserIsOwner(f string) bool {
|
|
|
|
return false
|
|
|
|
}
|
2015-06-15 09:36:19 -04:00
|
|
|
|
|
|
|
// setDefaultUmask doesn't do anything on windows
|
|
|
|
func setDefaultUmask() error {
|
|
|
|
return nil
|
|
|
|
}
|
2015-07-30 15:39:19 -04:00
|
|
|
|
|
|
|
func getDaemonConfDir() string {
|
|
|
|
return os.Getenv("PROGRAMDATA") + `\docker\config`
|
|
|
|
}
|
2015-09-23 19:42:08 -04:00
|
|
|
|
|
|
|
// notifySystem sends a message to the host when the server is ready to be used
|
|
|
|
func notifySystem() {
|
|
|
|
}
|
2015-12-10 18:35:10 -05:00
|
|
|
|
|
|
|
// setupConfigReloadTrap configures a Win32 event to reload the configuration.
|
|
|
|
func setupConfigReloadTrap(configFile string, flags *mflag.FlagSet, reload func(*daemon.Config)) {
|
|
|
|
go func() {
|
|
|
|
sa := syscall.SecurityAttributes{
|
|
|
|
Length: 0,
|
|
|
|
}
|
|
|
|
ev := "Global\\docker-daemon-config-" + fmt.Sprint(os.Getpid())
|
|
|
|
if h, _ := system.CreateEvent(&sa, false, false, ev); h != 0 {
|
|
|
|
logrus.Debugf("Config reload - waiting signal at %s", ev)
|
|
|
|
for {
|
|
|
|
syscall.WaitForSingleObject(h, syscall.INFINITE)
|
|
|
|
daemon.ReloadConfiguration(configFile, flags, reload)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
}
|