File tree Expand file tree Collapse file tree 4 files changed +20
-4
lines changed
internals/proxy/middlewares Expand file tree Collapse file tree 4 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,11 @@ func (data BodyMiddleware) Use() http.Handler {
2020 next := data .Next
2121
2222 return http .HandlerFunc (func (w http.ResponseWriter , req * http.Request ) {
23- messageAliases := getSettings (req ).MESSAGE_ALIASES
23+ messageAliases := getSettingsByReq (req ).MESSAGE_ALIASES
24+
25+ if messageAliases == nil {
26+ messageAliases = getSettings ("*" ).MESSAGE_ALIASES
27+ }
2428
2529 body , err := request .GetReqBody (w , req )
2630
Original file line number Diff line number Diff line change @@ -23,13 +23,17 @@ type contextKey string
2323
2424const tokenKey contextKey = "token"
2525
26- func getSettings (req * http.Request ) * config.SETTING_ {
26+ func getSettingsByReq (req * http.Request ) * config.SETTING_ {
2727 token , ok := req .Context ().Value (tokenKey ).(string )
2828
2929 if ! ok {
3030 token = "*"
3131 }
3232
33+ return getSettings (token )
34+ }
35+
36+ func getSettings (token string ) * config.SETTING_ {
3337 settings , exists := config .ENV .SETTINGS [token ]
3438
3539 if ! exists || settings == nil {
Original file line number Diff line number Diff line change @@ -15,7 +15,11 @@ func (data EndpointsMiddleware) Use() http.Handler {
1515 next := data .Next
1616
1717 return http .HandlerFunc (func (w http.ResponseWriter , req * http.Request ) {
18- blockedEndpoints := getSettings (req ).BLOCKED_ENDPOINTS
18+ blockedEndpoints := getSettingsByReq (req ).BLOCKED_ENDPOINTS
19+
20+ if blockedEndpoints == nil {
21+ blockedEndpoints = getSettings ("*" ).BLOCKED_ENDPOINTS
22+ }
1923
2024 reqPath := req .URL .Path
2125
Original file line number Diff line number Diff line change @@ -22,7 +22,11 @@ func (data TemplateMiddleware) Use() http.Handler {
2222 next := data .Next
2323
2424 return http .HandlerFunc (func (w http.ResponseWriter , req * http.Request ) {
25- variables := getSettings (req ).VARIABLES
25+ variables := getSettingsByReq (req ).VARIABLES
26+
27+ if variables == nil {
28+ variables = getSettings ("*" ).VARIABLES
29+ }
2630
2731 body , err := request .GetReqBody (w , req )
2832
You can’t perform that action at this time.
0 commit comments