updated as per the review comments
This commit is contained in:
24
pkg/plugin/implementation/reqpreprocessor/cmd/plugin.go
Normal file
24
pkg/plugin/implementation/reqpreprocessor/cmd/plugin.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/beckn/beckn-onix/pkg/plugin/implementation/reqpreprocessor"
|
||||
)
|
||||
|
||||
type provider struct{}
|
||||
|
||||
func (p provider) New(ctx context.Context, c map[string]string) (func(http.Handler) http.Handler, error) {
|
||||
config := &reqpreprocessor.Config{}
|
||||
if contextKeysStr, ok := c["contextKeys"]; ok {
|
||||
config.ContextKeys = strings.Split(contextKeysStr, ",")
|
||||
}
|
||||
if role, ok := c["role"]; ok {
|
||||
config.Role = role
|
||||
}
|
||||
return reqpreprocessor.NewPreProcessor(config)
|
||||
}
|
||||
|
||||
var Provider = provider{}
|
||||
Reference in New Issue
Block a user