Beispiel #1
0
func listenAndServe(conf incus.Configuration) {
	listenAddr := fmt.Sprintf(":%s", conf.Get("listening_port"))
	err := http.ListenAndServe(listenAddr, nil)
	if err != nil {
		log.Fatal(err)
	}
}
Beispiel #2
0
func listenAndServeTLS(conf incus.Configuration) {
	if conf.GetBool("tls_enabled") {
		tlsListenAddr := fmt.Sprintf(":%s", conf.Get("tls_port"))
		err := http.ListenAndServeTLS(tlsListenAddr, conf.Get("cert_file"), conf.Get("key_file"), nil)
		if err != nil {
			log.Println(err)
			log.Fatal(err)
		}
	}
}
Beispiel #3
0
func initLogger(conf incus.Configuration) {
	incus.DEBUG = false
	if conf.Get("log_level") == "debug" {
		incus.DEBUG = true
	}
}