maps-service/service.go
2024-11-25 17:19:45 -08:00

33 lines
589 B
Go

package main
import (
"git.itzana.me/strafesnet/data-service/internal/datastore/gormstore"
log "github.com/sirupsen/logrus"
"os"
)
func main() {
// Logger
debug := os.Getenv("DEBUG") == "true"
if debug {
log.SetLevel(log.DebugLevel)
log.SetFormatter(&log.TextFormatter{})
} else {
log.SetLevel(log.InfoLevel)
log.SetFormatter(&log.JSONFormatter{})
log.SetReportCaller(true)
}
log.Info("Starting server...")
// Postgres
db, err := gormstore.New(true)
if err != nil {
log.WithField("error", err).Fatalln("database startup failed")
return
}
rpc(db, debug)
}