Initial commit
This commit is contained in:
43
main.go
Normal file
43
main.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.coopgo.io/coopgo-platform/fleets/grpcapi"
|
||||
"git.coopgo.io/coopgo-platform/fleets/handlers"
|
||||
"git.coopgo.io/coopgo-platform/fleets/storage"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
cfg, err := ReadConfig()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
var (
|
||||
service_name = cfg.GetString("name")
|
||||
grpc_enable = cfg.GetBool("services.grpc.enable")
|
||||
)
|
||||
|
||||
storage, err := storage.NewStorage(cfg)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
handler := handlers.NewHandler(cfg, storage)
|
||||
|
||||
fmt.Println("Running", service_name, ":")
|
||||
|
||||
failed := make(chan error)
|
||||
|
||||
if grpc_enable {
|
||||
go grpcapi.Run(failed, cfg, handler)
|
||||
}
|
||||
|
||||
// Terminate if one of the services fails
|
||||
|
||||
err = <-failed
|
||||
|
||||
fmt.Println("Terminating :", err)
|
||||
}
|
||||
Reference in New Issue
Block a user