pidgin/carrier

Update convey.yml for the current standard
draft
2019-11-03, Gary Kramlich
925f33a47920
Update convey.yml for the current standard
package main
import (
"os"
"os/signal"
"syscall"
log "github.com/sirupsen/logrus"
"bitbucket.org/pidgin/carrier/config"
"bitbucket.org/pidgin/carrier/server"
)
func init() {
log.SetOutput(os.Stdout)
log.SetLevel(log.DebugLevel)
formatter := &log.TextFormatter{
FullTimestamp: true,
}
switch os.Getenv("TERM") {
case "win":
fallthrough
case "dumb":
formatter.DisableColors = true
}
log.SetFormatter(formatter)
}
func main() {
// create a signal channel for catching os signals
signalChan := make(chan os.Signal, 1)
signal.Notify(signalChan, syscall.SIGINT, syscall.SIGTERM)
// create an error channel to catch fatal errors
errChan := make(chan error, 1)
// create the http sever and run it in a go routine
go func() {
server := server.NewServer(config.Get().ListenAddr, errChan)
defer server.Stop()
server.Start()
}()
for {
select {
case err := <-errChan:
if err != nil {
log.Fatalf("error: %s", err)
return
}
case s := <-signalChan:
log.Warnf("captured %v, exiting...", s)
return
}
}
}