Native OCaml Rego/OPA policy engine
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add missing READMEs; expand short ones

New READMEs for: ocaml-auth, ocaml-cose, ocaml-http, ocaml-osv,
ocaml-rego, ocaml-scitt, ocaml-sigstore, ocaml-vec3.

Expanded: ca-certs (7→40 lines), osrelease (8→45 lines).

Each includes: synopsis, installation, usage example, API overview,
and license. Skipped ocaml-cel and ocaml-chor (no code yet).

+43
+43
README.md
··· 1 + ## rego -- native OCaml Rego/OPA policy engine 2 + 3 + Pure OCaml implementation of the [Rego](https://www.openpolicyagent.org/docs/latest/policy-language/) 4 + policy language (Open Policy Agent). Evaluates Rego policies against JSON 5 + input/data documents. Targets compliance with the OPA test suite (2,294 test 6 + cases across 145 categories). 7 + 8 + ## Installation 9 + 10 + ``` 11 + opam install rego 12 + ``` 13 + 14 + ## Quick Start 15 + 16 + ```ocaml 17 + let engine = Rego.engine () in 18 + let _ = 19 + Rego.add_policy engine ~name:"example.rego" 20 + {| 21 + package authz 22 + default allow = false 23 + allow { input.user == "admin" } 24 + |} 25 + in 26 + let input = 27 + Result.get_ok (Rego.Value.of_json_string {|{"user": "admin"}|}) 28 + in 29 + let result = Rego.eval engine ~input "data.authz.allow" in 30 + assert (result = Rego.Value.Bool true) 31 + ``` 32 + 33 + ## API 34 + 35 + - `Rego.engine` -- create a new policy engine 36 + - `Rego.add_policy` -- load a Rego policy module by name 37 + - `Rego.add_data` / `Rego.add_data_json` -- set the `data` document 38 + - `Rego.eval` -- evaluate a query against the loaded policies and input 39 + - `Rego.parse_module` / `Rego.parse_expr` -- parse Rego source to AST 40 + 41 + ## License 42 + 43 + ISC