Beispiel #1
0
//Register initializes Zmon backend
func (be *Zmon) Register() error {

	be.name = "Zmon"
	be.config = conf.New().Backends["zmon"]

	return nil
}
Beispiel #2
0
func init() {
	bin := path.Base(os.Args[0])
	flag.Usage = func() {
		fmt.Fprintf(os.Stderr, `
Usage of %s
================
Example:
  %% %s
`, bin, bin)
		flag.PrintDefaults()
	}
	serverConfig = conf.New()
	serverConfig.Version = Version
	serverConfig.BuildStamp = Buildstamp
	serverConfig.GitHash = Githash
	//config from file is loaded.
	//the values will be overwritten by command line flags
	flag.BoolVar(&serverConfig.PrintVersion, "version", false, "Print version and exit")
	flag.BoolVar(&serverConfig.DebugEnabled, "debug", serverConfig.DebugEnabled, "Enable debug output")
	flag.BoolVar(&serverConfig.Oauth2Enabled, "oauth", serverConfig.Oauth2Enabled, "Enable OAuth2")
	flag.StringVar(&serverConfig.AuthURL, "oauth-authurl", serverConfig.AuthURL, "OAuth2 Auth URL")
	flag.StringVar(&serverConfig.TokenURL, "oauth-tokeninfourl", serverConfig.TokenURL, "OAuth2 Auth URL")
	flag.StringVar(&serverConfig.TLSCertfilePath, "tls-cert", serverConfig.TLSCertfilePath, "TLS Certfile")
	flag.StringVar(&serverConfig.TLSKeyfilePath, "tls-key", serverConfig.TLSKeyfilePath, "TLS Keyfile")
	flag.IntVar(&serverConfig.Port, "port", serverConfig.Port, "Listening TCP Port of the service.")
	if serverConfig.Port == 0 {
		serverConfig.Port = 1234 //default port when no option is provided
	}
	flag.DurationVar(&serverConfig.LogFlushInterval, "flush-interval", time.Second*5, "Interval to flush Logs to disk.")
}
Beispiel #3
0
//Register is used to register the vault plugin in howler
func (v *Vault) Register() error { //FIXME: error should always be the last error type
	v.name = "Vault"
	config := conf.New().Backends["vault"]
	mandatoryConfigCheck(config)
	v.config = config
	sharedSecret = make(map[string]chan string)
	go v.startServer()
	return nil
}
Beispiel #4
0
// Register reads backend config for baboon
func (be *Baboon) Register() error {
	be.name = "Baboon"
	config := conf.New().Backends["baboon"]
	glog.Infof("%+v", config)
	glog.Infof("%s", config["tokenFile"])
	s := napping.Session{}
	s.Header = &http.Header{"Content-Type": []string{"application/json"}}
	be.config = config
	be.session = &s
	return nil
}
Beispiel #5
0
// rootHandler serving "/" which returns build information
func rootHandler(ginCtx *gin.Context) {
	config := conf.New()
	ginCtx.JSON(http.StatusOK, gin.H{"howler": fmt.Sprintf("Version: %s - Build Time: %s - Git Commit Hash: %s", config.Version, config.BuildStamp, config.GitHash)})
}