40 lines
900 B
Go
40 lines
900 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
|
|
cnf "git.pbiernat.io/egommerce/go-api-pkg/config"
|
|
|
|
"git.pbiernat.io/egommerce/catalog-service/internal/app"
|
|
"git.pbiernat.io/egommerce/catalog-service/internal/config"
|
|
"git.pbiernat.io/egommerce/catalog-service/internal/server"
|
|
)
|
|
|
|
func main() {
|
|
if cnf.ErrLoadingEnvs != nil {
|
|
log.Panicln("Error loading .env file", cnf.ErrLoadingEnvs)
|
|
}
|
|
|
|
c := config.NewServerConfig("catalog")
|
|
srv := server.New(c)
|
|
app := app.NewApp(c, srv)
|
|
|
|
app.RegisterHelper("cache", app.WithCache())
|
|
app.RegisterHelper("database", app.WithDatabase())
|
|
app.RegisterHelper("eventbus", app.WithEventbus())
|
|
app.RegisterHelper("logger", app.WithLogger())
|
|
app.RegisterHelper("registry", app.WithRegistry())
|
|
|
|
while := make(chan struct{})
|
|
err := app.Start(while)
|
|
<-while
|
|
|
|
if err != nil {
|
|
log.Fatalf("Failed to start application. Reason: %v\n", err)
|
|
os.Exit(1)
|
|
}
|
|
|
|
os.Exit(0)
|
|
}
|