Usage
Starting the server
The server is configured with a YAML file that is passed using the --config
flag. Values in the configuration file can be overridden from the command-line by the --set
flag — which can be used multiple times. See Configuration for more information about available configuration options.
Using the binary
./cerbos server --config=/path/to/config.yaml --set=server.httpListenAddr=:3592
Using Docker
docker run -i -t -p 3592:3592 \
-v /path/to/conf/dir:/config \
ghcr.io/cerbos/cerbos:0.13.0 \
server --config=/config/conf.yaml --set=server.httpListenAddr=:3592
See Server command for more information.
Compiling and testing policies
After authoring your policies you should run the compiler over the files to make sure they are valid. If you have policy tests they can be executed at this time as well.
Using the binary
# Compiles and run tests in the given directory
./cerbos compile /path/to/policies/dir
# To skip the tests
./cerbos compile /path/to/policies/dir --skip-tests
# To specify a different path to the tests directory
./cerbos compile /path/to/policies/dir --tests=/path/to/tests
Using Docker
docker run -i -t \
-v /path/to/policy/dir:/policies \
-v /path/to/test/dir:/tests \
ghcr.io/cerbos/cerbos:0.13.0 \
compile --tests=/tests /policies
See Compile command for more information.
Quick run
Add some policies to a directory named policies
and try Cerbos out using an application of your choice:
Using the binary
./cerbos run -- curl -I http://127.0.0.1:3592/_cerbos/health
See Run command for more information.