本文整理匯總了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
}