This tool is designed to help you manage roles, permissions, flows, and operations as code. The primary goal is to store Directus settings in human-readable JSON files so that they can be version-controlled and easily redeployed. Below, I'll provide a more detailed explanation of how to use these tools:
- You can save roles and permissions into JSON files, making it easy to version control and manage access control settings in Directus.
- These tools allow you to load roles and permissions from JSON files into a Directus instance, ensuring that your access control configurations can be easily restored.
- Flows and operations are also stored in JSON format, allowing you to save them as code in your projects.
- You can load flows and operations from JSON files into your Directus instance, enabling you to manage and maintain your workflows as code.
For testing purposes, you can start a local Directus instance using Docker. Here are the steps:
-
Navigate to the "test" directory.
-
Run the following Docker Compose command to start Directus locally:
docker-compose up
-
Open your web browser and visit http://localhost:8055/.
-
Log in using the provided credentials: username -
admin@example.com
, password -d1r3ctu5
. -
Set a static token for the admin user. In this case, the token is
GNuG2xodzTMY19AaYh0r7yYNWSqWF-AE
.
You should create collections within Directus as needed for your project.
Change your current directory to the "src" directory and run the following command to load roles and permissions:
python load_roles.py
To save roles and permissions, change your current directory to the "src" directory and run:
python save_roles.py
To save flows and operations, change your current directory to the "src" directory and run:
python save_flows.py
The script will attempt to save all the flows into a directory configured in the config.ini
file. Make sure to set the correct URL and token for Directus in the config.ini
file. You can use config.ini.sample
as a reference.
To load flows and operations, change your current directory to the "src" directory and run:
python load_flows.py
The script will try to load all the flows from a directory configured in the config.ini
file.