573 - New plugin - schema mapper
This commit is contained in:
23
pkg/plugin/implementation/reqmapper/cmd/plugin.go
Normal file
23
pkg/plugin/implementation/reqmapper/cmd/plugin.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/beckn-one/beckn-onix/pkg/plugin/implementation/reqmapper"
|
||||
)
|
||||
|
||||
type provider struct{}
|
||||
|
||||
func (p provider) New(ctx context.Context, c map[string]string) (func(http.Handler) http.Handler, error) {
|
||||
config := &reqmapper.Config{}
|
||||
if role, ok := c["role"]; ok {
|
||||
config.Role = role
|
||||
}
|
||||
if mappingsFile, ok := c["mappingsFile"]; ok {
|
||||
config.MappingsFile = mappingsFile
|
||||
}
|
||||
return reqmapper.NewReqMapper(config)
|
||||
}
|
||||
|
||||
var Provider = provider{}
|
||||
Reference in New Issue
Block a user