File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -48,17 +48,20 @@ func WithEnabledOtherParameter(on bool) Option {
4848// - BUNDEBUG=0 - disables the middleware.
4949// - BUNDEBUG=1 - enables the middleware.
5050// - BUNDEBUG=2 - enables the middleware and verbose mode.
51- // - BUNDEBUG=3 - enables the middleware and logs request heraders , path, ip and params.
51+ // - BUNDEBUG=3 - enables the middleware and logs request headers , path, ip and params.
5252
53- func FromEnv (key string ) Option {
54- if key == "" {
55- key = "BUNDEBUG"
53+ func FromEnv (keys ... string ) Option {
54+ if len ( keys ) == 0 {
55+ keys = [] string { "BUNDEBUG" }
5656 }
5757 return func (m * middleware ) {
58- if env , ok := os .LookupEnv (key ); ok {
59- m .enabled = env != "" && env != "0"
60- m .verbose = env == "2"
61- m .enabledOtherParameter = env == "3"
58+ for _ , key := range keys {
59+ if env , ok := os .LookupEnv (key ); ok {
60+ m .enabled = env != "" && env != "0"
61+ m .verbose = env == "2"
62+ m .enabledOtherParameter = env == "3"
63+ break
64+ }
6265 }
6366 }
6467}
You can’t perform that action at this time.
0 commit comments