當前位置: 首頁>>代碼示例>>Golang>>正文


Golang config.DefaultConfig函數代碼示例

本文整理匯總了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
}
開發者ID:cgrotz,項目名稱:hm9000,代碼行數:26,代碼來源:cli_runner_test.go

示例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
}
開發者ID:cgrotz,項目名稱:hm9000,代碼行數:8,代碼來源:bulk_app_state_test.go

示例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{
開發者ID:KeyOfSpectator,項目名稱:hm9000,代碼行數:30,代碼來源:apps_test.go

示例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()
	})
開發者ID:karlpilkington,項目名稱:golang-devops-stuff,代碼行數:31,代碼來源:pending_stop_messages_test.go

示例5: loadConfig

func (coordinator *MCATCoordinator) loadConfig() {
	conf, err := config.DefaultConfig()
	Ω(err).ShouldNot(HaveOccurred())
	coordinator.Conf = conf
}
開發者ID:philwhln,項目名稱:hm9000,代碼行數:5,代碼來源:mcat_coordinator_test.go


注:本文中的github.com/cloudfoundry/hm9000/config.DefaultConfig函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。