Load all .rego
files from a directory and evaluate it via golang rego library
#419
-
Hello, If you see, I am successfully able to load a policy file and evaluate it via rego engine, but the complete usecase looks something like this, where there is a Though there are bunch of resources on OPA CLI, I'm finding trouble implementing it in golang. Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
Hi there! This what you're looking for, I think: https://pkg.go.dev/github.com/open-policy-agent/opa/rego#Load |
Beta Was this translation helpful? Give feedback.
-
You may also be able to get some inspiration from Conftest, which works in a similar way: https://github.com/open-policy-agent/conftest/blob/master/policy/engine.go#L65 |
Beta Was this translation helpful? Give feedback.
-
Thanks @anderseknert. I'm trying the solution and looking at the reference 😃 |
Beta Was this translation helpful? Give feedback.
-
Thanks that works, if someone comes by this: here is the initial setup: meshery/meshkit#311 |
Beta Was this translation helpful? Give feedback.
Hi there! This what you're looking for, I think:
https://pkg.go.dev/github.com/open-policy-agent/opa/rego#Load