about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/http/http.go1
-rw-r--r--src/main.go15
-rw-r--r--src/structs/structs.go1
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