50 lines
1.6 KiB
Text
50 lines
1.6 KiB
Text
# Service Configuration Template
|
|
# Use this as a pattern for migrating user configs to schema-validated versions
|
|
# This example shows the pattern for any service configuration
|
|
|
|
# Template for: SERVICE_NAME Configuration
|
|
# 1. Import the service schema
|
|
# 2. Import service defaults
|
|
# 3. Import deployment mode defaults
|
|
# 4. Import helpers for deep merge
|
|
# 5. Define user overrides (only fields to change)
|
|
# 6. Use compose_config to merge: defaults + mode + overrides
|
|
# 7. Validate with type annotation
|
|
|
|
let service_schema = import "../SERVICE_NAME.ncl" in
|
|
let service_defaults = import "../defaults/SERVICE_NAME-defaults.ncl" in
|
|
let mode_config = import "../defaults/deployment/DEPLOYMENT_MODE-defaults.ncl" in
|
|
let helpers = import "../common/helpers.ncl" in
|
|
|
|
# Define user-specific overrides (only override what you need)
|
|
let user_overrides = {
|
|
# Example: workspace configuration
|
|
workspace = {
|
|
name = "my-service",
|
|
path = "/var/lib/provisioning/my-service",
|
|
},
|
|
|
|
# Example: server configuration
|
|
server = {
|
|
host = "0.0.0.0",
|
|
port = 9000,
|
|
workers = 4,
|
|
},
|
|
|
|
# Example: storage configuration (use only schema-supported fields)
|
|
storage = {
|
|
backend = "filesystem",
|
|
path = "/data/my-service",
|
|
},
|
|
|
|
# Add only the fields your service needs
|
|
# Other fields will be provided by defaults
|
|
} in
|
|
|
|
# Compose: apply defaults, then mode-specific tuning, then user overrides
|
|
# This ensures all required fields have values
|
|
helpers.compose_config
|
|
service_defaults.service_name
|
|
mode_config.service_name
|
|
user_overrides
|
|
|> (fun config => {service_name = config | service_schema.ServiceNameConfig})
|