70 lines
1.2 KiB
Markdown
70 lines
1.2 KiB
Markdown
|
|
# Common Defaults
|
||
|
|
|
||
|
|
Default configurations applied to all deployment modes.
|
||
|
|
|
||
|
|
## Files
|
||
|
|
|
||
|
|
### `server-defaults.ncl`
|
||
|
|
|
||
|
|
Default HTTP server configuration:
|
||
|
|
- Host: `0.0.0.0`
|
||
|
|
- Port: `8080`
|
||
|
|
- Workers: `4`
|
||
|
|
- Request timeout: `30000ms`
|
||
|
|
- Max connections: `1000`
|
||
|
|
- Graceful shutdown: `true`
|
||
|
|
|
||
|
|
### `database-defaults.ncl`
|
||
|
|
|
||
|
|
Default database configuration:
|
||
|
|
- URL: `ws://localhost:8000`
|
||
|
|
- Username: `root`
|
||
|
|
- Database: `vapora`
|
||
|
|
- Pool size: `20`
|
||
|
|
- Connection timeout: `30s`
|
||
|
|
|
||
|
|
### `monitoring-defaults.ncl`
|
||
|
|
|
||
|
|
Default monitoring configuration:
|
||
|
|
- Prometheus disabled
|
||
|
|
- Log level: `info`
|
||
|
|
- Tracing disabled
|
||
|
|
- Metrics path: `/metrics`
|
||
|
|
|
||
|
|
## Usage
|
||
|
|
|
||
|
|
Import common defaults in deployment configs:
|
||
|
|
|
||
|
|
```nickel
|
||
|
|
let server_defaults = import "common/server-defaults.ncl" in
|
||
|
|
let db_defaults = import "common/database-defaults.ncl" in
|
||
|
|
|
||
|
|
# In deployment config
|
||
|
|
{
|
||
|
|
backend = std.record.merge server_defaults {
|
||
|
|
workers = 8, # Override workers
|
||
|
|
},
|
||
|
|
|
||
|
|
database = db_defaults, # Use as-is
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
## Pattern
|
||
|
|
|
||
|
|
Common defaults are merged with mode-specific overrides:
|
||
|
|
|
||
|
|
```
|
||
|
|
Common Defaults
|
||
|
|
↓
|
||
|
|
Mode Defaults (override)
|
||
|
|
↓
|
||
|
|
User Customizations (override)
|
||
|
|
↓
|
||
|
|
Final Config
|
||
|
|
```
|
||
|
|
|
||
|
|
## References
|
||
|
|
|
||
|
|
- Parent: `../README.md`
|
||
|
|
- Deployment modes: `../deployment/README.md`
|