You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.0 KiB
Go

package main
import (
_"net/http"
_ "net/http/pprof"
"strconv"
//"flag"
//"log"
"os"
"fmt"
"FRMS/internal/pkg/logging"
//"FRMS/internal/pkg/config"
"FRMS/internal/pkg/server"
)
type coordinator interface {
Start()
}
func NewCoordinator(port int, ch chan error) coordinator {
return server.NewCentralCoordinator(port, ch)
}
func main() {
// lets get this bread
// go func() {
// fmt.Println(http.ListenAndServe("localhost:6060",nil))
// }()
ch := make(chan error)
var port int
var err error
if p := os.Getenv("gRPC_PORT"); p == "" {
port = 2022 // default docker port
} else {
if port, err = strconv.Atoi(p); err != nil {
panic(err)
}
}
//fmt.Printf("Listening on %v\n", lport)
c := NewCoordinator(port, ch)
go c.Start()
fmt.Println("Server Active!")
logging.Debug(logging.DStart, "CCO 01 Server started")
err = <-ch // blocking to wait for any errors and keep alive otherwise
panic(err)
}