diff --git a/example/main.go b/example/main.go index 9555187..71f7bd1 100644 --- a/example/main.go +++ b/example/main.go @@ -22,7 +22,7 @@ func main() { // read configs configure := gconfig.GetConfig() - if configure.Database.RDBMS.Activate == gconfig.Activated { + if gconfig.IsRDBMS() { // Initialize RDBMS client if err := gdatabase.InitDB().Error; err != nil { fmt.Println(err) @@ -50,7 +50,7 @@ func main() { } } - if configure.Database.REDIS.Activate == gconfig.Activated { + if gconfig.IsRedis() { // Initialize REDIS client if _, err := gdatabase.InitRedis(); err != nil { fmt.Println(err) @@ -58,7 +58,7 @@ func main() { } } - if configure.Database.MongoDB.Activate == gconfig.Activated { + if gconfig.IsMongo() { // Initialize MONGO client if _, err := gdatabase.InitMongo(); err != nil { fmt.Println(err) diff --git a/example/router/setupRouter.go b/example/router/setupRouter.go index 9744461..8fa4cfa 100644 --- a/example/router/setupRouter.go +++ b/example/router/setupRouter.go @@ -126,7 +126,7 @@ func SetupRouter(configure *gconfig.Configuration) (*gin.Engine, error) { v1.POST("register", gcontroller.CreateUserAuth) // Verify email - if configure.Security.VerifyEmail { + if gconfig.IsEmailVerificationService() { if gconfig.IsRedis() { v1.POST("verify", gcontroller.VerifyEmail) v1.POST("resend-verification-email", gcontroller.CreateVerificationEmail) @@ -159,13 +159,12 @@ func SetupRouter(configure *gconfig.Configuration) (*gin.Engine, error) { r2FA.POST("activate", gcontroller.Activate2FA) r2FA.POST("validate", gcontroller.Validate2FA) r2FA.POST("validate-backup-code", gcontroller.ValidateBackup2FA) - if gconfig.Is2FA() { - r2FA.Use(gmiddleware.TwoFA( - configure.Security.TwoFA.Status.On, - configure.Security.TwoFA.Status.Off, - configure.Security.TwoFA.Status.Verified, - )) - } + + r2FA.Use(gmiddleware.TwoFA( + configure.Security.TwoFA.Status.On, + configure.Security.TwoFA.Status.Off, + configure.Security.TwoFA.Status.Verified, + )) // get 2FA backup codes r2FA.POST("create-backup-codes", gcontroller.CreateBackup2FA) // disable 2FA