Refactor Policy Enforcer to Policy Checker
- Renamed the `PolicyEnforcer` interface and related implementations to `PolicyChecker` for clarity and consistency. - Updated configuration keys in YAML files to reflect the new `checkPolicy` terminology. - Adjusted related code, tests, and documentation to support the new naming convention and ensure compatibility. - Enhanced comments and examples for the `checkPolicy` configuration to improve usability.
This commit is contained in:
26
pkg/plugin/implementation/opapolicychecker/cmd/plugin.go
Normal file
26
pkg/plugin/implementation/opapolicychecker/cmd/plugin.go
Normal file
@@ -0,0 +1,26 @@
|
||||
// Package main provides the plugin entry point for the OPA Policy Checker plugin.
|
||||
// This file is compiled as a Go plugin (.so) and loaded by beckn-onix at runtime.
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/beckn-one/beckn-onix/pkg/plugin/definition"
|
||||
"github.com/beckn-one/beckn-onix/pkg/plugin/implementation/opapolicychecker"
|
||||
)
|
||||
|
||||
// provider implements the PolicyCheckerProvider interface for plugin loading.
|
||||
type provider struct{}
|
||||
|
||||
// New creates a new PolicyChecker instance.
|
||||
func (p provider) New(ctx context.Context, cfg map[string]string) (definition.PolicyChecker, func(), error) {
|
||||
checker, err := opapolicychecker.New(ctx, cfg)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
return checker, checker.Close, nil
|
||||
}
|
||||
|
||||
// Provider is the exported symbol that beckn-onix plugin manager looks up.
|
||||
var Provider = provider{}
|
||||
Reference in New Issue
Block a user