Documentation
¶
Overview ¶
Package configpolicy validates configuration with an embedded Rego policy.
A policy produces a document with these (optional) entrypoints:
processed - the input config with defaults injected (required) errors - a set/array of fatal error strings (joined into one error) warnings - a set/array of non-fatal warning strings
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EvalConfigInto ¶
EvalConfigInto decodes raw config bytes (absent/empty/null → empty object), evaluates the policy with input {"config": <raw>} to inject defaults, and decodes the processed config into out, returning any warnings. The typed unmarshal into out is what enforces field types, so a mistyped option surfaces here rather than in the policy.
Types ¶
type Policy ¶
type Policy struct {
// contains filtered or unexported fields
}
Policy is an embedded validation policy, compiled once on first use and evaluated repeatedly. Safe for concurrent use.
func New ¶
New returns a Policy for the given module: name is the module filename (and a prefix on infrastructure errors), source is its Rego, and query binds the result document to x (e.g. "data.opa.config = x").
func (*Policy) Compiler ¶
Compiler compiles the policy once and returns the reusable result. Exported so callers can run ad-hoc queries against the policy (e.g. drift-guard tests).