package fiber import ( "github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2/middleware/cors" "github.com/gofiber/fiber/v2/middleware/recover" "git.dmitriygnatenko.ru/dima/dmitriygnatenko-v2/internal/middleware/language" ) func initMiddleware(app *fiber.App, sp ServiceProvider) { app.Use(cors.New(getCORSConfig(sp))) app.Use(recover.New()) app.Use(language.New()) } func getCORSConfig(sp ServiceProvider) cors.Config { return cors.Config{ AllowOrigins: sp.ConfigService().CORSAllowOrigins(), AllowMethods: sp.ConfigService().CORSAllowMethods(), } }