0.1.0 • Published 2 years ago
directuspt v0.1.0
DirectusPT
A CLI to help operate on Directus in a GitOps style.
To get started, install it with npm i -g directuspt
Usage
Snapshot
directuspt snapshot will snapshot directus schema, permissions, folders and translations as a set of json files.
Additional options are:
-d, --destto set the destination path (./snapshotby default);--roles-filter {...}to set an additional filter when selecting roles to snapshot;--folders-filter {...}to set an additional filter when selecting folders to snapshot;--only [resource...]csv list of resources to snapshot. Valid values are: schema,translations,permissions,folders--except [resource...]csv list of resources to exclude from the snapshot. Valid values are: schema,translations,permissions,folders
Example:
directuspt snapshot --roles-filter '{"admin_access":{"_eq":false}}' --except folders,schemaApply
It applies the snapshot taken with directuspt snapshot.
Additional options are:
-s, --srcto set the source path (./snapshotby default);--only [resource...]csv list of resources to snapshot. Valid values are: schema,translations,permissions,folders--except [resource...]csv list of resources to exclude from the snapshot. Valid values are: schema,translations,permissions,folders
Example:
directuspt apply --only permissions,translationsCommon options
- Directus host can be set via
-H, --hostoption or via the env variableDIRECTUS_HOST. By defaulthttp://localhost:8055is used. - User credentials can be provided via
-e, --email,-p, --password,-o, --otp, or via the environment variablesDIRECTUS_USER_EMAIL,DIRECTUS_USER_PASSWORD,DIRECTUS_USER_OTP. The latter should be preferred to avoid exposing the password. - A user token can be provided via
-t, --token, or via the environment variableDIRECTUS_TOKEN. The latter should be preferred to avoid exposing the token.
TODO
Next steps:
- add flows and presets to the snapshots
- improve logging
- load config from file
- seed command