From 24e4058fc8190137e8111da21fa3d27c784285b6 Mon Sep 17 00:00:00 2001 From: Emile Date: Sun, 15 Mar 2020 18:47:39 +0100 Subject: imports Signed-off-by: Emile --- src/http/http.go | 1 + src/main.go | 15 ++++++++++++++- src/structs/structs.go | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 src/http/http.go create mode 100644 src/structs/structs.go (limited to 'src') diff --git a/src/http/http.go b/src/http/http.go new file mode 100644 index 0000000..d02cfda --- /dev/null +++ b/src/http/http.go @@ -0,0 +1 @@ +package http diff --git a/src/main.go b/src/main.go index 6a1a118..0c3479d 100644 --- a/src/main.go +++ b/src/main.go @@ -3,10 +3,13 @@ package main import ( "fmt" "log" - "net/http" + "os" + "os/signal" "strings" + "syscall" "git.darknebu.la/emile/corona-metrics/src/structs" + "git.darknebu.la/emile/corona-metrics/src/http" "github.com/sirupsen/logrus" "github.com/spf13/viper" ) @@ -65,3 +68,13 @@ func initLogging() { } } + +// ExitHandler handles exit signals such as ^C +func ExitHandler() { + c := make(chan os.Signal, 1) + signal.Notify(c, os.Interrupt, syscall.SIGTERM) + go func() { + <-c + os.Exit(1) + }() +} diff --git a/src/structs/structs.go b/src/structs/structs.go new file mode 100644 index 0000000..c025054 --- /dev/null +++ b/src/structs/structs.go @@ -0,0 +1 @@ +package structs -- cgit 1.4.1