Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/itaysk/prego
prego - pipe into rego
https://github.com/itaysk/prego
Last synced: 26 days ago
JSON representation
prego - pipe into rego
- Host: GitHub
- URL: https://github.com/itaysk/prego
- Owner: itaysk
- Created: 2020-04-22T12:19:19.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-12-22T17:04:41.000Z (almost 4 years ago)
- Last Synced: 2024-06-19T14:58:08.979Z (5 months ago)
- Language: Go
- Size: 46.9 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
Prego - Pipe into Rego
Prego is a stream processing cli tool that takes JSON from stdin, and processes it using [Rego](https://www.openpolicyagent.org/docs/latest/policy-language/) (the [Open Policy Agent](https://www.openpolicyagent.org/) language). It is inspired by [AWK](https://en.wikipedia.org/wiki/AWK) and can be thought of an AWK/Rego hybrid.
## Getting Prego
Currently you have to build from source. Clone the repo and run `make build`.## Getting Started
Let's try Prego with the included example in [test/example.rego](test/example.rego). This is an example that:
1. Prints the time when it started and finished.
2. Looks in the input json for `.foo` elements which have a value of `bar`.
1. Those items will be printed out.
3. Looks in the input json for `.hello` elements.
1. For those items it will print the value of `.hello` in uppercase letters.
4. Every other items that doesn't match those conditions will be ignored (not printed).Run `prego -f test/example.rego`, and type input documents (as JSON), or use the example data: `prego -f test/example.rego