32 lines
408 B
Go
32 lines
408 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
"syscall"
|
|
|
|
"os/signal"
|
|
)
|
|
|
|
func forever() {
|
|
c := make(chan os.Signal, 1)
|
|
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
|
|
|
|
sig := <-c
|
|
log.Printf("[INFO] shutting down, detected signal: %s", sig)
|
|
}
|
|
|
|
func main() {
|
|
cfg := initialize()
|
|
|
|
defer func() {
|
|
log.Println("[DEBUG] shutdown sequence complete")
|
|
}()
|
|
|
|
go cfg.httpServer()
|
|
|
|
go cfg.gatherMetrics()
|
|
|
|
forever()
|
|
}
|