The "runtime" project is a library that sits on top of OPA.
The goal of the project is to allow you to quickly write code that builds, runs or tests OPA policies.
It uses the options pattern to facilitate construction of Runtime
instances specific to your needs. You can start super simple, using it just to build some rego into a bundle, or you can get more complex, using it to start a runtime with plugins, built-ins and other features.
go get -u github.com/aserto-dev/runtime
// Create a runtime
r, cleanup, err := runtime.NewRuntime(ctx, &logger, &runtime.Config{})
if err != nil {
return errors.Wrap(err, "failed to create runtime")
}
defer cleanup()
// Use the runtime to build a bundle from the current directory
return r.Build(runtime.BuildParams{
OutputFile: "my-bundle.tar.gz",
}, ".")
You can find a more complete example in the example directory.
Based on the awesome Open Policy Agent.