https://cerbos.dev logo
#help
Title
# help
n

Nick Belovoskey

07/13/2023, 6:40 PM
Hey Cerbos team, I'm using Cerbos with a dynamic store. I'm noticing my directory with the yaml policies is not being added to my policy database. I've come to the conclusion that, if you're using Cerbos in "dynamic mode", you have to add policies through
addOrUpdatePolicies
. Is this correct? If so, Is there a way to programmatically add my yaml policies to my database, without having to convert them into their javascript object representation? If not, is there a way to programmatically convert yaml to javascript object? I'm using the JS SDK.
c

Charith (Cerbos)

07/13/2023, 6:56 PM
Hi. Yes, if you're using a database store, the policies have to be added to it using the Admin API. You could use the
cerbosctl
utility to do that as well. It can handle YAML files too. https://docs.cerbos.dev/cerbos/latest/cli/cerbosctl.html#put
n

Nick Belovoskey

07/13/2023, 7:23 PM
Awesome! Thanks for the help
a

Andrew Haines (Cerbos)

07/14/2023, 7:14 PM
I'm planning to add a JS package for loading YAML/JSON files to make this achievable with the SDK, too
n

Nick Belovoskey

08/21/2023, 8:57 PM
@Andrew Haines (Cerbos) That would be awesome. Is this on schedule for next release?
a

Andrew Haines (Cerbos)

08/22/2023, 6:32 AM
Oops, I forgot to post here when I published it! There's a new package available to load policy files: https://www.npmjs.com/package/@cerbos/files
n

Nick Belovoskey

08/23/2023, 2:04 AM
Works great! Thank you
3 Views