@reldens/cms 0.84.0 → 0.86.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,126 +1,128 @@
1
- # Configuration Guide
2
-
3
- ## Environment Variables
4
-
5
- ```env
6
- RELDENS_APP_HOST=http://localhost
7
- RELDENS_APP_PORT=8080
8
- RELDENS_ADMIN_ROUTE_PATH=/admin
9
- RELDENS_ADMIN_SECRET=your-secret-key
10
-
11
- RELDENS_DB_CLIENT=mysql
12
- RELDENS_DB_HOST=localhost
13
- RELDENS_DB_PORT=3306
14
- RELDENS_DB_NAME=cms_db
15
- RELDENS_DB_USER=username
16
- RELDENS_DB_PASSWORD=password
17
- RELDENS_STORAGE_DRIVER=prisma
18
-
19
- RELDENS_DEFAULT_DOMAIN=example.com
20
- RELDENS_DOMAIN_MAPPING={"dev.example.com":"development"}
21
- RELDENS_SITE_KEY_MAPPING={"example.com":"main"}
22
- ```
23
-
24
- ## Template Reloading Configuration
25
-
26
- Configure template reloading for development environments:
27
-
28
- ```javascript
29
- const cms = new Manager({
30
- // Development: reload templates on every request when changes detected
31
- reloadTime: -1,
32
-
33
- // Production: disable template reloading (default)
34
- reloadTime: 0,
35
-
36
- // Interval-based: reload every 5 seconds when changes detected
37
- reloadTime: 5000
38
- });
39
- ```
40
-
41
- **Template Reloading Options:**
42
-
43
- - `reloadTime: 0` (default) - Template reloading disabled. Templates load once at startup.
44
- - `reloadTime: -1` - Reload templates on every request when file changes are detected. Best for active development.
45
- - `reloadTime: > 0` - Check for template changes at specified interval (milliseconds) and reload when needed. Good for development with lower overhead.
46
-
47
- **How it works:**
48
-
49
- - Tracks file modification times for admin and frontend templates
50
- - Only reloads templates that have actually changed
51
- - Automatically updates admin contents and frontend template cache
52
- - Works with both admin panel templates and frontend templates/partials
53
- - Zero performance impact when disabled (`reloadTime: 0`)
54
-
55
- ## Custom Entity Configuration
56
-
57
- ```javascript
58
- const entityConfig = {
59
- articles: {
60
- listProperties: ['title', 'status', 'created_at'],
61
- showProperties: ['title', 'content', 'author', 'status'],
62
- editProperties: ['title', 'content', 'author_id', 'status'],
63
- filterProperties: ['status', 'author_id'],
64
- titleProperty: 'title',
65
- parentItemLabel: 'Content',
66
- properties: {
67
- title: { type: 'string', isRequired: true },
68
- content: { type: 'text' },
69
- author_id: { type: 'reference', reference: 'users' },
70
- featured_image: {
71
- type: 'string',
72
- isUpload: true,
73
- allowedTypes: 'image',
74
- bucket: 'uploads'
75
- }
76
- }
77
- }
78
- };
79
-
80
- const cms = new Manager({
81
- entitiesConfig: entityConfig
82
- });
83
- ```
84
-
85
- ## Manager Configuration Options
86
-
87
- ```javascript
88
- const cms = new Manager({
89
- projectRoot: process.cwd(),
90
-
91
- // Entity Access Control
92
- entityAccess: {
93
- cmsPages: { public: true, operations: ['read'] },
94
- articles: { public: true, operations: ['read'] },
95
- users: { public: false }
96
- },
97
-
98
- // Authentication
99
- authenticationMethod: 'db-users',
100
- adminRoleId: 99,
101
- authenticationCallback: async (email, password, roleId) => {
102
- return await yourAuthService.validate(email, password, roleId);
103
- },
104
-
105
- // Performance
106
- cache: true,
107
- reloadTime: 0,
108
-
109
- // Multi-Domain
110
- defaultDomain: 'example.com',
111
- domainMapping: {'dev.example.com': 'development'},
112
- siteKeyMapping: {'example.com': 'main'},
113
-
114
- // Custom Entities
115
- entitiesConfig: entityConfig,
116
- entitiesTranslations: {},
117
- adminTranslations: {},
118
-
119
- // Optional Custom Services
120
- app: customExpressApp,
121
- appServer: customAppServer,
122
- dataServer: customDataServer,
123
- adminManager: customAdmin,
124
- frontend: customFrontend
125
- });
126
- ```
1
+ # Configuration Guide
2
+
3
+ ## Environment Variables
4
+
5
+ ```env
6
+ RELDENS_APP_HOST=http://localhost
7
+ RELDENS_APP_PORT=8080
8
+ RELDENS_ADMIN_ROUTE_PATH=/admin
9
+ RELDENS_ADMIN_SECRET=your-secret-key
10
+
11
+ RELDENS_DB_CLIENT=mysql
12
+ RELDENS_DB_HOST=localhost
13
+ RELDENS_DB_PORT=3306
14
+ RELDENS_DB_NAME=cms_db
15
+ RELDENS_DB_USER=username
16
+ RELDENS_DB_PASSWORD=password
17
+ RELDENS_STORAGE_DRIVER=mikro-orm
18
+ RELDENS_PRISMA_ADAPTER=@prisma/adapter-mariadb
19
+ RELDENS_PRISMA_ADAPTER_CLASS=PrismaMariaDb
20
+
21
+ RELDENS_DEFAULT_DOMAIN=example.com
22
+ RELDENS_DOMAIN_MAPPING={"dev.example.com":"development"}
23
+ RELDENS_SITE_KEY_MAPPING={"example.com":"main"}
24
+ ```
25
+
26
+ ## Template Reloading Configuration
27
+
28
+ Configure template reloading for development environments:
29
+
30
+ ```javascript
31
+ const cms = new Manager({
32
+ // Development: reload templates on every request when changes detected
33
+ reloadTime: -1,
34
+
35
+ // Production: disable template reloading (default)
36
+ reloadTime: 0,
37
+
38
+ // Interval-based: reload every 5 seconds when changes detected
39
+ reloadTime: 5000
40
+ });
41
+ ```
42
+
43
+ **Template Reloading Options:**
44
+
45
+ - `reloadTime: 0` (default) - Template reloading disabled. Templates load once at startup.
46
+ - `reloadTime: -1` - Reload templates on every request when file changes are detected. Best for active development.
47
+ - `reloadTime: > 0` - Check for template changes at specified interval (milliseconds) and reload when needed. Good for development with lower overhead.
48
+
49
+ **How it works:**
50
+
51
+ - Tracks file modification times for admin and frontend templates
52
+ - Only reloads templates that have actually changed
53
+ - Automatically updates admin contents and frontend template cache
54
+ - Works with both admin panel templates and frontend templates/partials
55
+ - Zero performance impact when disabled (`reloadTime: 0`)
56
+
57
+ ## Custom Entity Configuration
58
+
59
+ ```javascript
60
+ const entityConfig = {
61
+ articles: {
62
+ listProperties: ['title', 'status', 'created_at'],
63
+ showProperties: ['title', 'content', 'author', 'status'],
64
+ editProperties: ['title', 'content', 'author_id', 'status'],
65
+ filterProperties: ['status', 'author_id'],
66
+ titleProperty: 'title',
67
+ parentItemLabel: 'Content',
68
+ properties: {
69
+ title: { type: 'string', isRequired: true },
70
+ content: { type: 'text' },
71
+ author_id: { type: 'reference', reference: 'users' },
72
+ featured_image: {
73
+ type: 'string',
74
+ isUpload: true,
75
+ allowedTypes: 'image',
76
+ bucket: 'uploads'
77
+ }
78
+ }
79
+ }
80
+ };
81
+
82
+ const cms = new Manager({
83
+ entitiesConfig: entityConfig
84
+ });
85
+ ```
86
+
87
+ ## Manager Configuration Options
88
+
89
+ ```javascript
90
+ const cms = new Manager({
91
+ projectRoot: process.cwd(),
92
+
93
+ // Entity Access Control
94
+ entityAccess: {
95
+ cmsPages: { public: true, operations: ['read'] },
96
+ articles: { public: true, operations: ['read'] },
97
+ users: { public: false }
98
+ },
99
+
100
+ // Authentication
101
+ authenticationMethod: 'db-users',
102
+ adminRoleId: 99,
103
+ authenticationCallback: async (email, password, roleId) => {
104
+ return await yourAuthService.validate(email, password, roleId);
105
+ },
106
+
107
+ // Performance
108
+ cache: true,
109
+ reloadTime: 0,
110
+
111
+ // Multi-Domain
112
+ defaultDomain: 'example.com',
113
+ domainMapping: {'dev.example.com': 'development'},
114
+ siteKeyMapping: {'example.com': 'main'},
115
+
116
+ // Custom Entities
117
+ entitiesConfig: entityConfig,
118
+ entitiesTranslations: {},
119
+ adminTranslations: {},
120
+
121
+ // Optional Custom Services
122
+ app: customExpressApp,
123
+ appServer: customAppServer,
124
+ dataServer: customDataServer,
125
+ adminManager: customAdmin,
126
+ frontend: customFrontend
127
+ });
128
+ ```