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: services/backend/GLOBAL_SETTINGS.md
+236Lines changed: 236 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,11 +7,22 @@ This document describes the global key-value store system for managing applicati
7
7
The global settings system provides secure storage for application-wide configuration values such as:
8
8
9
9
-**SMTP Server Credentials**: Host, port, username, password for email functionality
10
+
-**OAuth Credentials**: GitHub OAuth client ID and secret for authentication
10
11
-**API Keys**: External service credentials (OpenAI, AWS, etc.)
11
12
-**System Configuration**: Application-wide settings and feature flags
12
13
-**Integration Credentials**: Third-party service authentication tokens
13
14
-**Environment Variables**: Dynamic configuration that can be changed without code deployment
14
15
16
+
### Auto-Initialization System
17
+
18
+
The system includes an **auto-initialization feature** that automatically creates missing global settings when the server starts. Settings are defined in modular files within the `src/global-settings/` directory, and the system will:
19
+
20
+
- Scan for setting definition files on startup
21
+
- Check which settings exist in the database
22
+
- Create missing settings with default values (non-destructive)
The auto-initialization system automatically creates missing global settings when the server starts. This ensures that all required settings are available without manual configuration, while preserving existing values.
506
+
507
+
### File-Based Setting Definitions
508
+
509
+
Settings are defined in TypeScript files within the `src/global-settings/` directory:
510
+
511
+
```text
512
+
src/global-settings/
513
+
├── types.ts # Type definitions
514
+
├── index.ts # Auto-discovery service
515
+
├── smtp.ts # SMTP configuration
516
+
├── github-oauth.ts # GitHub OAuth settings
517
+
└── [custom].ts # Your custom settings
518
+
```
519
+
520
+
### Setting Definition Format
521
+
522
+
Each setting file exports a `GlobalSettingsModule`:
0 commit comments