permitio / cedar-agent

Cedar-agent is the easiest way to deploy and run Cedar
Apache License 2.0
144 stars 9 forks source link

Load entities and policies from json file #12

Closed cleissonbarbosa closed 1 year ago

cleissonbarbosa commented 1 year ago

Reason: Unable to load a large amount of entities (30,000 - 4.5MB) from the /data endpoint

What PR does: Adds the possibility to load entities and policies from a json file at rocket startup

Use the -d or --data option and inform the path of the json file you want to load in cedar's memory, it is also possible to use a DATA environment variable

examples:

cargo run -- -d "./examples/data.json"
cargo run -- --data="./examples/data.json"
export DATA="./examples/data.json"
cargo run

Use the --policies option and inform the path of the json file you want to load in cedar's memory, it is also possible to use a POLICIES environment variable

examples:

cargo run -- --policies="./examples/policies.json"
export POLICIES="./examples/policies.json"
cargo run
cleissonbarbosa commented 1 year ago

@omer9564 Thank you very much for the review, in addition to the changes you requested, I changed the word policy to policies in the config.

cleissonbarbosa commented 1 year ago

two suggestion comments ( might make the code simpler ) one missing new line again 😅 , Besides that it looks great 💪

😅 thank you very much for the suggestion.

orweis commented 1 year ago

@cleissonbarbosa - I love what I'm seeing here - Kudos. @danielbass37 can we make sure @cleissonbarbosa gets some swag, in show of appreciation for his OSS contribution here.

danielbass37 commented 1 year ago

@cleissonbarbosa PMed you in the community <3

cleissonbarbosa commented 1 year ago

@orweis @danielbass37 Thank you guys 💜