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.

46 lines
978 B
Go

package main
3 years ago
import (
_"net/http"
_ "net/http/pprof"
"flag"
"log"
"os"
"fmt"
"FRMS/internal/pkg/logging"
3 years ago
"FRMS/internal/pkg/server"
3 years ago
)
type listener interface {
3 years ago
Start()
}
func NewListener(ch chan error) listener {
return server.NewListener(ch)
}
3 years ago
func main() {
// lets get this bread
// all we need to do is call the reactor coordinator and thats it
// removing os flags in favor of env vars
// go func() {
// fmt.Println(http.ListenAndServe("localhost:6060",nil))
// }()
3 years ago
ch := make(chan error)
// creating listener
l := NewListener()
if port := os.Getenv("gRPC_PORT"); port == 0 {
l.Port = 2022 // default docker port
}
db := os.Getenv("DATABASE_URL") // database url
go l.Start()
logging.Debug(logging.DStart, "CCO 01 Server started")
err = <-ch // blocking to wait for any errors and keep alive otherwise
if err != nil {
log.Fatal(err)
}
}