refactor: Make a skeleton of main.go (openkeepd binary)

This commit is contained in:
ChronosX88 2019-10-12 17:24:58 +04:00
parent 225fcd598d
commit 313a3b6af6
Signed by: ChronosXYZ
GPG Key ID: 085A69A82C8C511A
2 changed files with 32 additions and 0 deletions

1
.gitignore vendored
View File

@ -10,3 +10,4 @@
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
/openkeepd

31
cmd/openkeepd/main.go Normal file
View File

@ -0,0 +1,31 @@
package main
import (
"os"
"os/signal"
"syscall"
"github.com/sirupsen/logrus"
)
var logger = logrus.New()
func main() {
logger.Info("Starting openkeepd server...")
logger.Info("Server successfully started!")
// CTRL+C handler.
signalHandler := make(chan os.Signal, 1)
shutdownDone := make(chan bool, 1)
signal.Notify(signalHandler, os.Interrupt, syscall.SIGTERM)
go func() {
<-signalHandler
logger.Info("CTRL+C or SIGTERM received, shutting down openkeepd...")
shutdownDone <- true
}()
<-shutdownDone
logger.Info("Server successfully shutted down")
os.Exit(0)
}