This repository was archived by the owner on Dec 27, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ type Config struct {
20
20
GitlabCIScript string `mapstructure:"FEATWS_API_GITLAB_CI_SCRIPT"`
21
21
ExternalHost string `mapstructure:"EXTERNAL_HOST"`
22
22
OpenAMURL string `mapstructure:"OPENAM_URL"`
23
+ AuthMode string `mapstructure:"FEATWS_API_AUTH_MODE"`
23
24
}
24
25
25
26
var config = & Config {}
@@ -43,6 +44,7 @@ func LoadConfig() (err error) {
43
44
viper .SetDefault ("FEATWS_API_GITLAB_CI_SCRIPT" , "" )
44
45
viper .SetDefault ("EXTERNAL_HOST" , "localhost:9007" )
45
46
viper .SetDefault ("OPENAM_URL" , "" )
47
+ viper .SetDefault ("FEATWS_API_AUTH_MODE" , "none" )
46
48
47
49
err = viper .ReadInConfig ()
48
50
if err != nil {
Original file line number Diff line number Diff line change 1
1
package v1
2
2
3
3
import (
4
+ "strings"
5
+
6
+ "github.com/bancodobrasil/featws-api/config"
4
7
"github.com/bancodobrasil/featws-api/middlewares"
5
8
"github.com/gin-gonic/gin"
6
9
)
7
10
8
11
// Router define routes the API V1
9
12
func Router (router * gin.RouterGroup ) {
10
- router .Use (middlewares .VerifyAuthToken ())
13
+ cfg := config .GetConfig ()
14
+
15
+ switch strings .ToLower (cfg .AuthMode ) {
16
+ case "openam" :
17
+ router .Use (middlewares .VerifyAuthToken ())
18
+ }
19
+
11
20
rulesheetsRouter (router .Group ("/rulesheets" ))
12
21
//rpcRouter(router.Group("/"))
13
22
}
You can’t perform that action at this time.
0 commit comments