coverage/cmd/server/main.go

39 lines
563 B
Go

package main
import (
"fmt"
"log"
"os"
"os/signal"
"gitea.teamortix.com/team-ortix/coverage/db"
"gitea.teamortix.com/team-ortix/coverage/server"
)
var (
port = os.Getenv("COVERAGE_PORT")
dbFile = os.Getenv("DB_FILE")
)
func main() {
if port == "" {
port = "8080"
}
if dbFile == "" {
dbFile = "coverage.db"
}
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt)
go func() {
db.OpenDatabase(dbFile)
server.StartServer(port)
}()
log.Printf("server starting. at http://0.0.0.0:%s", port)
<-c
fmt.Println("\nAborting...")
}