本文整理匯總了Golang中github.com/docker/swarmkit/cli.ExternalCAOpt.Value方法的典型用法代碼示例。如果您正苦於以下問題:Golang ExternalCAOpt.Value方法的具體用法?Golang ExternalCAOpt.Value怎麽用?Golang ExternalCAOpt.Value使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/docker/swarmkit/cli.ExternalCAOpt
的用法示例。
在下文中一共展示了ExternalCAOpt.Value方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
if err := http.ListenAndServe(debugAddr, nil); err != nil {
panic(err)
}
}()
}
n, err := agent.NewNode(&agent.NodeConfig{
Hostname: hostname,
ForceNewCluster: forceNewCluster,
ListenControlAPI: unix,
ListenRemoteAPI: addr,
JoinAddr: managerAddr,
StateDir: stateDir,
CAHash: caHash,
Secret: secret,
ExternalCAs: externalCAOpt.Value(),
Executor: executor,
HeartbeatTick: hb,
ElectionTick: election,
IsManager: ismanager,
})
if err != nil {
return err
}
if err := n.Start(ctx); err != nil {
return err
}
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt)
示例2:
}
flags := cmd.Flags()
spec := &cluster.Spec
var rotation api.KeyRotation
if flags.Changed("certexpiry") {
cePeriod, err := flags.GetDuration("certexpiry")
if err != nil {
return err
}
ceProtoPeriod := ptypes.DurationProto(cePeriod)
spec.CAConfig.NodeCertExpiry = ceProtoPeriod
}
if flags.Changed("external-ca") {
spec.CAConfig.ExternalCAs = externalCAOpt.Value()
}
if flags.Changed("taskhistory") {
taskHistory, err := flags.GetInt64("taskhistory")
if err != nil {
return err
}
spec.Orchestration.TaskHistoryRetentionLimit = taskHistory
}
if flags.Changed("heartbeatperiod") {
hbPeriod, err := flags.GetDuration("heartbeatperiod")
if err != nil {
return err
}
spec.Dispatcher.HeartbeatPeriod = ptypes.DurationProto(hbPeriod)
}