package app import ( "context" "log/slog" httpsrv "recipes/internal/app/httpSrv" "recipes/internal/cache_provider/redis" "recipes/internal/config" "recipes/internal/media_storage/minio" "recipes/internal/storage/postgresql" ) type App struct { HTTPSrv *httpsrv.App } func New(log *slog.Logger, cfg *config.Config) *App { // init storage storage, err := postgresql.New(context.Background(), cfg.Postgresql.User, cfg.Postgresql.Password, cfg.Postgresql.Address, cfg.Postgresql.DBName) if err != nil { panic(err) } // init cache cache := redis.New(cfg.Redis.Address, cfg.Redis.Password, storage) // init media storage mstorage, err := minio.New(context.Background(), cfg.Minio.Address, cfg.Minio.User, cfg.Minio.Password) if err != nil { panic(err) } // init http server httpsrv := httpsrv.New(log, &cfg.HTTPServerConfig, cache, mstorage) // return return &App{HTTPSrv: httpsrv} }