You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+39-30Lines changed: 39 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
A lot of configuration of your Strapi project is stored in the database. Like core_store, user permissions, user roles & webhooks. Things you might want to have the same on all environments. But when you update them locally, you will have to manually update them on all other environments too.
4
4
5
-
That's where this plugin comes in to play. It allows you to export these configs as individual JSON files for each config, and write them somewhere in your project. With the configs written in your filesystem your can keep track of them through version control (git), and easily pull and import them across environments.
5
+
That's where this plugin comes in to play. It allows you to export these configs as individual JSON files for each config, and write them somewhere in your project. With the configs written in your filesystem you can keep track of them through version control (git), and easily pull and import them across environments.
6
6
7
7
Importing, exporting and keeping track of config changes is done in the admin page of the plugin.
8
8
@@ -27,44 +27,50 @@ This way your app won't reload when you export the config in development.
27
27
28
28
admin: {
29
29
auth: {
30
-
...
30
+
// ...
31
31
},
32
32
watchIgnoreFiles: [
33
33
'**/config-sync/files/**',
34
-
]
34
+
],
35
35
},
36
36
37
37
38
38
## Settings
39
-
Some settings for the plugin are able to be modified by creating a file `extensions/config-sync/config/config.json` and overwriting the default settings.
40
-
41
-
#### Default settings:
42
-
{
43
-
"destination": "extensions/config-sync/files/",
44
-
"minify": false,
45
-
"importOnBootstrap": false,
46
-
"include": [
47
-
"core-store",
48
-
"role-permissions",
49
-
"webhooks"
50
-
],
51
-
"exclude": []
52
-
}
39
+
The settings of the plugin can be overridden in the `config/plugins.js` file.
40
+
In the example below you can see how, and also what the default settings are.
41
+
42
+
##### `config/plugins.js`:
43
+
module.exports = ({ env }) => ({
44
+
// ...
45
+
'config-sync': {
46
+
destination: "extensions/config-sync/files/",
47
+
minify: false,
48
+
importOnBootstrap: false,
49
+
include: [
50
+
"core-store",
51
+
"role-permissions"
52
+
],
53
+
exclude: [
54
+
"core-store.plugin_users-permissions_grant"
55
+
]
56
+
},
57
+
// ...
58
+
});
53
59
54
-
| Property |Default| Description |
55
-
| -------- | -------| ----------- |
56
-
| destination |extensions/config-sync/files/| The path for reading and writing the config JSON files. |
57
-
| minify |false| Setting to minify the JSON that's being exported. It defaults to false for better readability in git commits. |
58
-
| importOnBootstrap |false|Allows you to let the config be imported automaticly when strapi is bootstrapping (on `yarn start`). This setting should only be used in production, and should be handled very carefully as it can unintendedly overwrite the changes in your database. PLEASE USE WITH CARE. |
59
-
| include |["core-store", "role-permissions", "webhooks"]|Configs you want to include. Allowed values: `core-store`, `role-permissions`, `webhooks`. |
60
-
| exclude |[]| You might not want all your database config exported and managed in git. This settings allows you to add an array of config names which should not be tracked by the config-sync plugin. *Currently not working*|
60
+
| Property |Type| Description |
61
+
| -------- | ---- | ----------- |
62
+
| destination |string| The path for reading and writing the sync files. |
63
+
| minify |bool|When enabled all the exported JSON files will be minified. |
64
+
| importOnBootstrap |bool| Allows you to let the config be imported automaticly when strapi is bootstrapping (on `strapi start`). This setting should only be used in production, and should be handled very carefully as it can unintendedly overwrite the changes in your database. PLEASE USE WITH CARE. |
65
+
| include |array |Configs types you want to include in the syncing process. Allowed values: `core-store`, `role-permissions`, `webhooks`. |
66
+
| exclude |array|Specify the names of configs you want to exclude from the syncing process. By default the API tokens for users-permissions, which are stored in core_store, are excluded. This setting expects the config names to comply with the naming convention.|
61
67
62
68
## Naming convention
63
69
All the config files written in the file destination have the same naming convention. It goes as follows:
64
70
65
71
[config-type].[config-name].json
66
72
67
-
-`config-type` - Corresponds to the value in from the config.include setting.
73
+
-`config-type` - Corresponds to the value in from the include setting.
68
74
-`config-name` - The unique identifier of the config.
69
75
- For `core-store` config this is the `key` value.
70
76
- For `role-permissions` config this is the `type` value.
@@ -78,7 +84,14 @@ All the config files written in the file destination have the same naming conven
78
84
- Exporting of EE roles & permissions
79
85
- Add partial import/export functionality
80
86
- Add CLI commands for importing/exporting
81
-
- Track config deletions
87
+
-~~Track config deletions~~
88
+
89
+
## ⭐️ Show your support
90
+
91
+
Give a star if this project helped you.
92
+
93
+
## Credits
94
+
Shout out to [@ScottAgirs](https://github.com/ScottAgirs) for making [strapi-plugin-migrate](https://github.com/ijsto/strapi-plugin-migrate) as it was a big help while making the config-sync plugin.
82
95
83
96
## Resources
84
97
@@ -88,7 +101,3 @@ All the config files written in the file destination have the same naming conven
0 commit comments