Skip to content

Commit

Permalink
restructure on initialization of middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
RabbITCybErSeC committed Dec 9, 2024
1 parent 03b8ea7 commit b0143cb
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions internal/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,8 @@ func Initialize() error {

cacheSize, _ := strconv.Atoi(utils.GetEnv("MAX_EXECUTIONS", strconv.Itoa(defaultCacheSize)))
mainCache = *cache.New(&timeUtil.Time{}, cacheSize)
err := intializeAuthenticationMiddleware(app)
if err != nil {
log.Error("Failed to setup Authentication middleware")
return err
}

err = initializeCore(app)
err := initializeCore(app)
if err != nil {
log.Error("Failed to init core")
return err
Expand All @@ -196,7 +191,12 @@ func initializeCore(app *gin.Engine) error {
origins := strings.Split(strings.ReplaceAll(utils.GetEnv("SOARCA_ALLOWED_ORIGINS", "*"), " ", ""), ",")
routes.Cors(app, origins)

err := mainController.setupDatabase()
err := intializeAuthenticationMiddleware(app)
if err != nil {
log.Error("Failed to setup Authentication middleware")
return err
}
err = mainController.setupDatabase()
if err != nil {
log.Error("Failed to setup database:", err)
return err
Expand Down

0 comments on commit b0143cb

Please sign in to comment.