Sync: update the directory structure convention for policies
Currently policies are created in a Git repo with the following structure, where group is a directory and policy name and version are separated with underscore _
symbol.
/group/policyname_1.0.rego
We need to update the structure so that each part is a separate directory and the final directory can contain multiple static files loaded during policy execution as data
. The example above should be transformed to the following:
/group/policyname/1.0/policy.rego
/group/policyname/1.0/data.json
If there is data.json
file inside the directory, it should be synced too as an attribute of the policy record in Mongo. For example, a synced policy in Mongo is a JSON object similar to:
{
"name":"policyname",
"group":"examplegroup",
"version":"1.0",
"locked":false,
"data": {...}
}
The data
field could be empty, but if such static data file is found in the directory, it should be placed in the data
attribute of the policy.
Edited by Lyuben Penkovski