本文整理汇总了Golang中github.com/cloudfoundry/hm9000/config.DefaultConfig函数的典型用法代码示例。如果您正苦于以下问题:Golang DefaultConfig函数的具体用法?Golang DefaultConfig怎么用?Golang DefaultConfig使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DefaultConfig函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: generateConfig
func (runner *CLIRunner) generateConfig(storeURLs []string, ccBaseURL string, natsPort int, metricsServerPort int) *config.Config {
tmpFile, err := ioutil.TempFile("/tmp", "hm9000_clirunner")
defer tmpFile.Close()
Ω(err).ShouldNot(HaveOccurred())
runner.configPath = tmpFile.Name()
conf, err := config.DefaultConfig()
Ω(err).ShouldNot(HaveOccurred())
conf.StoreURLs = storeURLs
conf.CCBaseURL = ccBaseURL
conf.NATS[0].Port = natsPort
conf.SenderMessageLimit = 8
conf.MaximumBackoffDelayInHeartbeats = 6
conf.MetricsServerPort = metricsServerPort
conf.MetricsServerUser = "bob"
conf.MetricsServerPassword = "password"
conf.StoreMaxConcurrentRequests = 10
conf.ListenerHeartbeatSyncIntervalInMilliseconds = 100
conf.APIServerPort = int(5155 + ginkgo.GinkgoParallelNode())
err = json.NewEncoder(tmpFile).Encode(conf)
Ω(err).ShouldNot(HaveOccurred())
return conf
}
示例2: makeHandlerAndStore
func makeHandlerAndStore(conf HandlerConf) (http.Handler, store.Store, error) {
config, _ := config.DefaultConfig()
store := store.NewStore(config, conf.StoreAdapter, fakelogger.NewFakeLogger())
handler, err := handlers.New(conf.Logger, store, conf.TimeProvider)
return handler, store, err
}
示例3:
var _ = Describe("Apps", func() {
var (
store Store
storeAdapter storeadapter.StoreAdapter
conf *config.Config
dea appfixture.DeaFixture
app1 appfixture.AppFixture
app2 appfixture.AppFixture
app3 appfixture.AppFixture
app4 appfixture.AppFixture
crashCount []models.CrashCount
)
conf, _ = config.DefaultConfig()
BeforeEach(func() {
storeAdapter = etcdstoreadapter.NewETCDStoreAdapter(etcdRunner.NodeURLS(), workerpool.NewWorkerPool(conf.StoreMaxConcurrentRequests))
err := storeAdapter.Connect()
Ω(err).ShouldNot(HaveOccurred())
store = NewStore(conf, storeAdapter, fakelogger.NewFakeLogger())
dea = appfixture.NewDeaFixture()
app1 = dea.GetApp(0)
app2 = dea.GetApp(1)
app3 = dea.GetApp(2)
app4 = dea.GetApp(3)
actualState := []models.InstanceHeartbeat{
示例4:
"time"
)
var _ = Describe("Storing PendingStopMessages", func() {
var (
store Store
storeAdapter storeadapter.StoreAdapter
conf *config.Config
message1 models.PendingStopMessage
message2 models.PendingStopMessage
message3 models.PendingStopMessage
)
BeforeEach(func() {
var err error
conf, err = config.DefaultConfig()
Ω(err).ShouldNot(HaveOccurred())
storeAdapter = etcdstoreadapter.NewETCDStoreAdapter(etcdRunner.NodeURLS(), workerpool.NewWorkerPool(conf.StoreMaxConcurrentRequests))
err = storeAdapter.Connect()
Ω(err).ShouldNot(HaveOccurred())
message1 = models.NewPendingStopMessage(time.Unix(100, 0), 10, 4, "ABC", "123", "XYZ", models.PendingStopMessageReasonInvalid)
message2 = models.NewPendingStopMessage(time.Unix(100, 0), 10, 4, "DEF", "456", "ALPHA", models.PendingStopMessageReasonInvalid)
message3 = models.NewPendingStopMessage(time.Unix(100, 0), 10, 4, "GHI", "789", "BETA", models.PendingStopMessageReasonInvalid)
store = NewStore(conf, storeAdapter, fakelogger.NewFakeLogger())
})
AfterEach(func() {
storeAdapter.Disconnect()
})
示例5: loadConfig
func (coordinator *MCATCoordinator) loadConfig() {
conf, err := config.DefaultConfig()
Ω(err).ShouldNot(HaveOccurred())
coordinator.Conf = conf
}