// Like Serve, but enables TLS using the given config. func ServeTLS(config *tls.Config) { if !flag.Parsed() { flag.Parse() } ServeListener(tls.NewListener(bind.Default(), config)) }
// Serve starts kami with reasonable defaults. // It works (exactly) like Goji, looking for Einhorn, the bind flag, GOJI_BIND... func Serve() { if !flag.Parsed() { flag.Parse() } // Install our handler at the root of the standard net/http default mux. // This allows packages like expvar to continue working as expected. http.Handle("/", Handler()) listener := bind.Default() log.Println("Starting kami on", listener.Addr()) graceful.HandleSignals() bind.Ready() graceful.PreHook(func() { log.Printf("kami received signal, gracefully stopping") }) graceful.PostHook(func() { log.Printf("kami stopped") }) err := graceful.Serve(listener, http.DefaultServeMux) if err != nil { log.Fatal(err) } graceful.Wait() }
// Serve starts Goji using reasonable defaults. func Serve() { if !flag.Parsed() { flag.Parse() } ServeListener(bind.Default()) }
// Serve starts Goji using reasonable defaults. func Serve() { if !flag.Parsed() { flag.Parse() } log.SetFlags(log.Flags() | log.Lmicroseconds) // Install our handler at the root of the standard net/http default mux. // This allows packages like expvar to continue working as expected. http.Handle("/", DefaultMux) listener := bind.Default() log.Println("Starting Goji on", listener.Addr()) graceful.HandleSignals() bind.Ready() err := graceful.Serve(listener, http.DefaultServeMux) if err != nil { log.Fatal(err) } graceful.Wait() }
/** *There was no support of TLS in kami *Copy-paste from Goji **/ func ServeTLS(config *tls.Config) { if !flag.Parsed() { flag.Parse() } http.Handle("/", kami.Handler()) listener := tls.NewListener(bind.Default(), config) log.Println("Starting kami on", listener.Addr()) graceful.HandleSignals() bind.Ready() graceful.PreHook(func() { log.Printf("kami received signal, gracefully stopping") }) graceful.PostHook(func() { log.Printf("kami stopped") }) err := graceful.Serve(listener, http.DefaultServeMux) if err != nil { log.Fatal(err) } graceful.Wait() }
// Like Serve, but enables TLS using the given config. func ServeTLS(config *tls.Config) { ServeListener(tls.NewListener(bind.Default(), config)) }
// Serve starts Goji using reasonable defaults. func Serve() { ServeListener(bind.Default()) }