Exemplo n.º 1
0
func main() {
	configFilePath := flag.String("config", "config/config.json", "Path to config params for the consumer")
	flag.Parse()

	config, err := config.Parse(*configFilePath)
	if err != nil {
		log.Fatalf("Error parsing config: %s", err.Error())
	}

	tokenFetcher := &uaatokenfetcher.UAATokenFetcher{
		UaaUrl:                config.UAAURL,
		Username:              config.Username,
		Password:              config.Password,
		InsecureSSLSkipVerify: config.InsecureSSLSkipVerify,
	}

	metrics_nozzle := nozzle.NewNozzle(config, tokenFetcher, os.Stdout, os.Stderr)
	metrics_nozzle.Start()

}
Exemplo n.º 2
0
package config_test

import (
	config "github.com/benlaplanche/metrics-consumer/config"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Config", func() {

	It("successfully parses a valid config file", func() {
		conf, err := config.Parse("config.json")

		Expect(err).ToNot(HaveOccurred())

		Expect(conf.UAAURL).To(Equal("https://uaa.10.244.0.34.xip.io"))
		Expect(conf.Username).To(Equal("admin"))
		Expect(conf.Password).To(Equal("admin-secret"))
		Expect(conf.DopplerAddr).To(Equal("wss://doppler.10.244.0.34.xip.io:4443"))
		Expect(conf.InsecureSSLSkipVerify).To(Equal(true))
		Expect(conf.FirehoseSubscriptionId).To(Equal("metrics-consumer-1"))

		Expect(conf.OriginID).To(Equal("service-metrics"))

	})

})