diff --git a/entrypoint.go b/entrypoint.go index 1e1cf57..1995b6e 100644 --- a/entrypoint.go +++ b/entrypoint.go @@ -29,9 +29,9 @@ import ( "cloud.o-forge.io/core/oc-lib/models/workflow_execution" "cloud.o-forge.io/core/oc-lib/models/workspace" "cloud.o-forge.io/core/oc-lib/tools" - "github.com/beego/beego/plugins/cors" beego "github.com/beego/beego/v2/server/web" "github.com/beego/beego/v2/server/web/context" + "github.com/beego/beego/v2/server/web/filter/cors" "github.com/google/uuid" "github.com/goraz/onion" "github.com/rs/zerolog" @@ -205,13 +205,14 @@ func Init(appName string) { beego.BConfig.Listen.HTTPPort = config.GetConfig().APIPort beego.BConfig.WebConfig.DirectoryIndex = true beego.BConfig.WebConfig.StaticDir["/swagger"] = "swagger" - beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{ + c := cors.Allow(&cors.Options{ AllowAllOrigins: true, AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"}, AllowHeaders: []string{"Origin", "Authorization", "Content-Type"}, ExposeHeaders: []string{"Content-Length", "Content-Type"}, AllowCredentials: true, - })) + }) + beego.InsertFilter("*", beego.BeforeRouter, c) api := &tools.API{} api.Discovered(beego.BeeApp.Handlers.GetAllControllerInfo()) }