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.
47 lines
1.0 KiB
Go
47 lines
1.0 KiB
Go
package main
|
|
|
|
import (
|
|
_"net/http"
|
|
_ "net/http/pprof"
|
|
//"flag"
|
|
"log"
|
|
"os"
|
|
"fmt"
|
|
"FRMS/internal/pkg/logging"
|
|
"FRMS/internal/pkg/server"
|
|
)
|
|
|
|
type listener interface {
|
|
Start()
|
|
}
|
|
|
|
func NewListener(ch chan error, port int) listener {
|
|
return server.NewListener(ch, port)
|
|
}
|
|
|
|
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))
|
|
// }()
|
|
ch := make(chan error)
|
|
// creating listener
|
|
var lport int
|
|
if port := os.Getenv("gRPC_PORT"); port == "" {
|
|
lport = 2022 // default docker port
|
|
}
|
|
fmt.Printf("Listening on %v\n", lport)
|
|
l := NewListener(ch,lport)
|
|
|
|
//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)
|
|
}
|
|
}
|