This monorepo, opa-la for short is where all the MapColonies related authentication lies.
The main idea of the repo is to store authentication data and create Open Policy Agent (OPA in short) bundles when the data changes. After a bundle was created we upload them to S3 so OPA can fetch them using the bundles API.
Before we start making any changes to the repository, we need to bootstrap the repository. To do so we need to run the following commands:
npm install && npx lerna run build
All the code packages in the monorepo are documented using TypeDoc. The auto generated site is available at here.
flowchart TD
A[1. Check for changes] -->|no changes| B(2. Compare bundle hash)
A -->|changes detectd| C[3. Fetch bundle content from database]
B -->|hash is the same| A
B -->|hash not equal| C
C --> D[4. Template Files]
D --> E[5. Run tests]
E --> F[6. Create bundle]
F --> G[7. Upload bundle]
G --> H[8. Save bundle metadata]
H --> A
The bundle is made of all the the policy files, the data files based on the path parameter, and the public key under the keys key.
The example found in the repository shows the usage of the bundle.
When an Asset is marked as templated, we use a rendering engine to render it into the final Asset. The context of the rendering process (object given as parameter for the engine) is an array of all the Connections that are relevant for the bundle environment.
For more information about the rendering engine check templating-engine.
Generated using TypeDoc