本文整理汇总了Golang中github.com/CiscoCloud/drone/shared/envconfig.Env.Get方法的典型用法代码示例。如果您正苦于以下问题:Golang Env.Get方法的具体用法?Golang Env.Get怎么用?Golang Env.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/CiscoCloud/drone/shared/envconfig.Env
的用法示例。
在下文中一共展示了Env.Get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Load
// Load creates a new build engine, loaded with registered nodes from the
// database. The registered nodes are added to the pool of nodes to immediately
// start accepting workloads.
func Load(env envconfig.Env, s store.Store) Engine {
engine := &engine{}
engine.bus = newEventbus()
engine.pool = newPool()
engine.updater = &updater{engine.bus}
// quick fix to propogate HTTP_PROXY variables
// throughout the build environment.
var proxyVars = []string{"HTTP_PROXY", "http_proxy", "HTTPS_PROXY", "https_proxy", "NO_PROXY", "no_proxy"}
for _, proxyVar := range proxyVars {
proxyVal := env.Get(proxyVar)
if len(proxyVal) != 0 {
engine.envs = append(engine.envs, proxyVar+"="+proxyVal)
}
}
nodes, err := s.Nodes().GetList()
if err != nil {
log.Fatalf("failed to get nodes from database. %s", err)
}
for _, node := range nodes {
engine.pool.allocate(node)
log.Infof("registered docker daemon %s", node.Addr)
}
return engine
}
示例2: Load
func Load(env envconfig.Env) Remote {
driver := env.Get("REMOTE_DRIVER")
switch driver {
case "bitbucket":
return bitbucket.Load(env)
case "github":
return github.Load(env)
case "gitlab":
return gitlab.Load(env)
case "gogs":
return gogs.Load(env)
default:
log.Fatalf("unknown remote driver %s", driver)
}
return nil
}