本文整理汇总了Golang中github.com/docker/libcompose/project.Project.AddConfig方法的典型用法代码示例。如果您正苦于以下问题:Golang Project.AddConfig方法的具体用法?Golang Project.AddConfig怎么用?Golang Project.AddConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/docker/libcompose/project.Project
的用法示例。
在下文中一共展示了Project.AddConfig方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: addServices
func addServices(p *project.Project, enabled map[interface{}]interface{}, configs map[string]*composeConfig.ServiceConfigV1) map[interface{}]interface{} {
serviceConfigsV2, _ := composeConfig.ConvertServices(configs)
// Note: we ignore errors while loading services
unchanged := true
for name, serviceConfig := range serviceConfigsV2 {
hash := composeConfig.GetServiceHash(name, serviceConfig)
if enabled[name] == hash {
continue
}
if err := p.AddConfig(name, serviceConfig); err != nil {
log.Infof("Failed loading service %s", name)
continue
}
if unchanged {
enabled = util.MapCopy(enabled)
unchanged = false
}
enabled[name] = hash
}
return enabled
}
示例2: addServices
func addServices(p *project.Project, cfg *config.CloudConfig, enabled map[string]string, configs map[string]*project.ServiceConfig) {
// Note: we ignore errors while loading services
for name, serviceConfig := range configs {
hash := project.GetServiceHash(name, *serviceConfig)
if enabled[name] == hash {
continue
}
if err := p.AddConfig(name, serviceConfig); err != nil {
log.Infof("Failed loading service %s", name)
continue
}
enabled[name] = hash
}
}