本文整理匯總了Golang中github.com/drone/drone/shared/envconfig.Env.Get方法的典型用法代碼示例。如果您正苦於以下問題:Golang Env.Get方法的具體用法?Golang Env.Get怎麽用?Golang Env.Get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/drone/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
}