示例#1
0
文件: disk.go 项目: Jdesk/os
func LoadConfig() (*CloudConfig, error) {
	cfg, err := ChainCfgFuncs(NewConfig(),
		readFilesAndMetadata,
		readCmdline,
		amendNils)
	if err != nil {
		log.WithFields(log.Fields{"cfg": cfg, "err": err}).Error("Failed to load config")
		return nil, err
	}

	log.Debug("Merging cloud-config from meta-data and user-data")
	cfg = mergeMetadata(cfg, readMetadata())

	if cfg.Rancher.Debug {
		log.SetLevel(log.DebugLevel)
		if !util.Contains(cfg.Rancher.Docker.Args, "-D") {
			cfg.Rancher.Docker.Args = append(cfg.Rancher.Docker.Args, "-D")
		}
		if !util.Contains(cfg.Rancher.SystemDocker.Args, "-D") {
			cfg.Rancher.SystemDocker.Args = append(cfg.Rancher.SystemDocker.Args, "-D")
		}
	}

	return cfg, nil
}
示例#2
0
文件: config.go 项目: pirater/os
func isPathToStringify(path []interface{}) bool {
	l := len(path)
	if l == 0 {
		return false
	}
	if sk, ok := path[l-1].(string); ok {
		return util.Contains(keysToStringify, sk)
	}
	return false
}