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 | |
parent | 2886564f260fbc540cf8f13149958d12a796f5c6 (diff) |
imports
Signed-off-by: Emile <hanemile@protonmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/http/http.go | 1 | ||||
-rw-r--r-- | src/main.go | 15 | ||||
-rw-r--r-- | src/structs/structs.go | 1 |
3 files changed, 16 insertions, 1 deletions
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 |