https://github.com/aserto-dev/runtime
an abstraction library on top of OPA
https://github.com/aserto-dev/runtime
golang opa
Last synced: 6 months ago
JSON representation
an abstraction library on top of OPA
- Host: GitHub
- URL: https://github.com/aserto-dev/runtime
- Owner: aserto-dev
- License: apache-2.0
- Created: 2021-09-24T19:22:23.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2025-04-09T21:32:02.000Z (6 months ago)
- Last Synced: 2025-04-09T22:28:30.446Z (6 months ago)
- Topics: golang, opa
- Language: Go
- Homepage:
- Size: 4.34 MB
- Stars: 27
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# runtime - an abstraction library on top of the Open Policy Agent (OPA)
[](https://pkg.go.dev/github.com/aserto-dev/runtime)
[](https://goreportcard.com/report/github.com/aserto-dev/runtime)## Introduction
The "runtime" project is a library that sits on top of [OPA](https://github.com/open-policy-agent/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.
## Install
```shell
go get -u github.com/aserto-dev/runtime
```## Usage
```go
// 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](./example/) directory.
## Credits
Based on the awesome [Open Policy Agent](https://github.com/open-policy-agent/opa).