|
|
|
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) listener {
|
|
|
|
return server.NewListener(ch)
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
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)
|
|
|
|
}
|
|
|
|
}
|