Hello I am new with `Cerbos`. I was trying to run...
# help
i
Hello I am new with
Cerbos
. I was trying to run
Cerbos
with
MySQL
. There is a doc for how to run and create schemas. But I could not find any doc how should I insert my policies on the
MySQL
tables. Sample Finance Application Policy https://play.cerbos.dev/p/XhkOi82fFKk3YW60e2c806Yvm0trKEje This is the playground URL I was trying to read from
MySQL
. Thanks
o
Hi @Imadul Islam, For the mutable stores (postgres, mysql etc.), you may use the AdminAPI to add or update policies. AdminAPI should be enabled under the
server
in your configuration like this (Also, here is the list of all possible configuration options if you’d like to explore more);
Copy code
server:
  adminAPI:
    adminCredentials:
      passwordHash: JDJ5JDEwJEdEOVFzZDE2VVhoVkR0N2VkUFBVM09nalc0QnNZaC9xc2E4bS9mcUJJcEZXenp5OUpjMi91Cgo= # PasswordHash is the base64-encoded bcrypt hash of the password to use for authentication.
      username: cerbos # Username is the hardcoded username to use for authentication.
    enabled: true # Enabled defines whether the admin API is enabled.
Here is the relevant part to send a request to the AdminAPI for adding/updating policies; https://docs.cerbos.dev/cerbos/latest/api/admin_api.html#_addupdate_policies
Also, one other option is using the
cerbosctl
CLI. https://docs.cerbos.dev/cerbos/latest/cli/cerbosctl.html#put Hope this helps, please let me know if you encounter any problems or have any questions.
i
Thank you so much @oguzhan for the help. This might work. I will try with Admin API.
s
Hi @Imadul Islam! Coincidentally, I’ve just finished building a demo showing how an admin API integration might look, using Golang. I’m not sure of your tech stack, but perhaps this could be useful: https://github.com/cerbos/demo-admin-api
i
Thank you @Sam Lock (Cerbos)