image-storage/cmd/main.go

38 lines
745 B
Go
Raw Normal View History

2025-10-20 18:23:53 +03:00
package main
import (
2025-10-20 22:21:55 +03:00
"context"
log "github.com/sirupsen/logrus"
2025-10-20 18:23:53 +03:00
"imageStorage/config"
"imageStorage/internal/app"
2025-10-20 22:21:55 +03:00
"imageStorage/internal/convert"
"imageStorage/internal/mainHandler"
"os"
"os/signal"
"syscall"
2025-10-20 18:23:53 +03:00
)
func main() {
c := config.NewConfig()
2025-10-20 22:21:55 +03:00
//c := config.DevConfig()
2025-10-20 18:23:53 +03:00
config.LogSetup(c.App.LogLevel)
2025-10-20 22:21:55 +03:00
log.Infof("Log level: %s", c.App.LogLevel)
2025-10-20 18:23:53 +03:00
2025-10-20 22:21:55 +03:00
ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
defer cancel()
converter := convert.NewHandler()
imageServerHandler := mainHandler.NewHandler(mainHandler.Deps{
Converter: converter,
})
a := app.NewApp(app.Deps{
Config: c,
GrpcServer: imageServerHandler,
})
if err := a.Start(ctx); err != nil {
log.Fatal(err)
}
2025-10-20 18:23:53 +03:00
}