image-storage/cmd/main.go
2025-10-20 22:21:55 +03:00

37 lines
745 B
Go

package main
import (
"context"
log "github.com/sirupsen/logrus"
"imageStorage/config"
"imageStorage/internal/app"
"imageStorage/internal/convert"
"imageStorage/internal/mainHandler"
"os"
"os/signal"
"syscall"
)
func main() {
c := config.NewConfig()
//c := config.DevConfig()
config.LogSetup(c.App.LogLevel)
log.Infof("Log level: %s", c.App.LogLevel)
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)
}
}