298System Config
Technical settings per environment. DEV / TEST / PROD rows override the DEFAULT row.
Try it
Effective config
What the application sees in one environment: its own row, otherwise the DEFAULT row| Key | Value | From |
|---|---|---|
| app.base-url | https://erp.example.com | PROD |
| feature.new-dashboard | false | DEFAULT |
| log.level | INFO | DEFAULT |
| mail.smtp.host | smtp.example.com | PROD |
| mail.smtp.password | deβ’β’β’β’β’β’et π | PROD |
| mail.smtp.port | 587 | PROD |
| report.max-rows | 5000 | DEFAULT |
| storage.path | ./storage | DEFAULT |
Change history (config_history)
| Key | Old β new | When |
|---|---|---|
| No changes yet - edit a config row. | ||
| # | Key | Environment | Value | Secret | Status | |
|---|---|---|---|---|---|---|
| 1 | app.base-url | DEFAULT | http://localhost:8184 | Active | βοΈ | |
| 2 | app.base-url | PROD | https://erp.example.com | Active | βοΈ | |
| 10 | feature.new-dashboard | DEFAULT | false | Active | βοΈ | |
| 11 | feature.new-dashboard | DEV | true | Active | βοΈ | |
| 12 | log.level | DEFAULT | INFO | Active | βοΈ | |
| 13 | log.level | DEV | DEBUG | Active | βοΈ | |
| 3 | mail.smtp.host | DEFAULT | localhost | Active | βοΈ | |
| 4 | mail.smtp.host | PROD | smtp.example.com | Active | βοΈ | |
| 7 | mail.smtp.password | PROD | deβ’β’β’β’β’β’et | β | Active | βοΈ |
| 5 | mail.smtp.port | DEFAULT | 25 | Active | βοΈ | |
| 6 | mail.smtp.port | PROD | 587 | Active | βοΈ | |
| 8 | payment.api-key | TEST | skβ’β’β’β’β’β’56 | β | Active | βοΈ |
| 14 | report.max-rows | DEFAULT | 5000 | Active | βοΈ | |
| 9 | storage.path | DEFAULT | ./storage | Active | βοΈ |
Showing 1β14 of 14
π Learn: how this master is built table system_config
Key points
- Fallback lookup: ConfigService.get(key, env) tries env first, then DEFAULT.
- Every change is kept in config_history (MasterListeners.configHistory).
Code
- Entity
domain/SystemConfig.java- Repository
repo/SystemConfigRepository.java- Definition
MasterRegistry: "config"- Page / form
web/MasterController.java- Try-it panel
templates/tools/config-resolve.html- REST API
GET /api/config/mail.smtp.host?env=PROD
SQL to try in SSMS (database MasterDataLabDB)
DECLARE @env NVARCHAR(10) = 'PROD'; SELECT k.config_key, COALESCE(e.config_value, d.config_value) AS value FROM (SELECT DISTINCT config_key FROM system_config) k LEFT JOIN system_config e ON e.config_key = k.config_key AND e.environment = @env LEFT JOIN system_config d ON d.config_key = k.config_key AND d.environment = 'DEFAULT';