Workshop slides:
https://drive.google.com/file/d/1xNNvnniHgKUpBKj9GMUnTHk0RwRbrSHR
cd /usr/local/bin
curl -L -o opa https://github.com/open-policy-agent/opa/releases/download/v0.12.1/opa_darwin_amd64
chmod 755 ./opa
OPA is also available on Homebrew but no up to date version.
Download from here:
https://github.com/open-policy-agent/opa/releases/download/v0.12.1/opa_windows_amd64.exe
Download from here:
https://github.com/open-policy-agent/opa/releases/download/v0.12.1/opa_linux_amd64
# change working directory to cloned workshop repo root
cd opa-workshop
opa eval data.intro.helloWorld -d ./policies -f values
You should see:
[
"Hello World"
]
opa run ./policies
You will see:
OPA 0.12.1 (commit 2799e148, built at 2019-07-06T15:26:21Z)
Run 'help' to see a list of commands.
>
You can try out some simple expressions:
> true
true
> 3.14
3.14
> ["hello", "world"]
[
"hello",
"world"
]
You can also test simple boolean expressions:
> true == false
false
> 3.14 > 3
true
> "hello" != "goodbye"
true
Quit out of the REPL by pressing Control-D or typing exit:
> exit
Exiting
opa run ./policies -s
To stop the server, press ctrl + c
Test server:
curl http://localhost:8181/v1/data/intro/helloWorld
You should see:
{"result":"Hello World"}