Commit 47f764e
committed
ast: add feature registration from the outside
If I add this to `main.go` (imagine another executable including OPA),
```diff
diff --git a/main.go b/main.go
index 9d5aea6..5126479107 100644
--- a/main.go
+++ b/main.go
@@ -8,9 +8,11 @@
"os"
"github.com/open-policy-agent/opa/cmd"
+ "github.com/open-policy-agent/opa/v1/ast"
)
func main() {
+ ast.RegisterFeatures("foo", "bar", "baz")
if err := cmd.RootCommand.Execute(); err != nil {
os.Exit(1)
}
```
and I subsequently run `opa capabilities --current`, we'll find (other
stuff omitted):
```json
{
"features": [
"bar",
"baz",
"foo",
"keywords_in_refs",
"rego_v1"
]
}
```
Signed-off-by: Stephan Renatus <stephan@styra.com>1 parent 5430c72 commit 47f764e
1 file changed
Lines changed: 20 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
60 | 78 | | |
61 | 79 | | |
62 | 80 | | |
| |||
141 | 159 | | |
142 | 160 | | |
143 | 161 | | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
| 162 | + | |
| 163 | + | |
148 | 164 | | |
149 | 165 | | |
150 | 166 | | |
| |||
0 commit comments