diff options
author | Emile <hanemile@protonmail.com> | 2020-03-15 18:47:39 +0100 |
---|---|---|
committer | Emile <hanemile@protonmail.com> | 2020-03-15 18:47:39 +0100 |
commit | 24e4058fc8190137e8111da21fa3d27c784285b6 (patch) | |
tree | 2a8537d0bbfe204583857bef75f27dce1045b2db /src/main.go | |
parent | 2886564f260fbc540cf8f13149958d12a796f5c6 (diff) |
imports
Signed-off-by: Emile <hanemile@protonmail.com>
Diffstat (limited to 'src/main.go')
-rw-r--r-- | src/main.go | 15 |
1 files changed, 14 insertions, 1 deletions
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) + }() +} |