provisioning/schemas/platform/common/constraints.ncl

86 lines
3.4 KiB
Text

# Platform Constraints and Validators
# AUTOMATICALLY GENERATED from constraints.toml - DO NOT EDIT DIRECTLY
# Generated via: nickel eval scripts/generate-constraints.ncl
# Source: schemas/platform/constraints/constraints.toml
#
# Usage: Import in schemas to validate configuration fields
# Example: port | constraints.port_standard
#
# To modify constraints, edit constraints.toml and run:
# nickel eval scripts/generate-constraints.ncl > schemas/platform/common/constraints.ncl
let contract = std.contract in
{
# Valid port range (avoid system ports < 1024)
port_standard = contract.from_validator (fun x =>
if x >= 1024 && x <= 65535 then 'Ok
else 'Error {message = "port_standard must be between 1024 and 65535"}
),
# Platform service ports (>= 9000)
port_high = contract.from_validator (fun x =>
if x >= 9000 && x <= 65535 then 'Ok
else 'Error {message = "port_high must be between 9000 and 65535"}
),
# Vault service port number
vault_port = contract.from_validator (fun x =>
if x >= 1024 && x <= 65535 then 'Ok
else 'Error {message = "vault_port must be between 1024 and 65535"}
),
# Extension registry server port
registry_port = contract.from_validator (fun x =>
if x >= 1024 && x <= 65535 then 'Ok
else 'Error {message = "registry_port must be between 1024 and 65535"}
),
# Workflow engine worker thread count
workers = contract.from_validator (fun x =>
if x >= 1 && x <= 32 then 'Ok
else 'Error {message = "workers must be between 1 and 32"}
),
# HTTP server worker thread count
server_workers = contract.from_validator (fun x =>
if x >= 1 && x <= 32 then 'Ok
else 'Error {message = "server_workers must be between 1 and 32"}
),
# Maximum concurrent HTTP connections
max_connections = contract.from_validator (fun x =>
if x >= 10 && x <= 10000 then 'Ok
else 'Error {message = "max_connections must be between 10 and 10000"}
),
# Retry attempts for failed tasks
retry_attempts = contract.from_validator (fun x =>
if x >= 0 && x <= 10 then 'Ok
else 'Error {message = "retry_attempts must be between 0 and 10"}
),
# Metrics collection interval in seconds (10s-5min)
metrics_interval = contract.from_validator (fun x =>
if x >= 10 && x <= 300 then 'Ok
else 'Error {message = "metrics_interval must be between 10 and 300"}
),
# Health check interval in seconds (5s-5min)
health_check_interval = contract.from_validator (fun x =>
if x >= 5 && x <= 300 then 'Ok
else 'Error {message = "health_check_interval must be between 5 and 300"}
),
# Task execution timeout in milliseconds (1min-24hrs)
task_timeout = contract.from_validator (fun x =>
if x >= 60000 && x <= 86400000 then 'Ok
else 'Error {message = "task_timeout must be between 60000 and 86400000"}
),
# Tool execution timeout in milliseconds (5s-10min)
tool_timeout = contract.from_validator (fun x =>
if x >= 5000 && x <= 600000 then 'Ok
else 'Error {message = "tool_timeout must be between 5000 and 600000"}
),
# HTTP keep-alive timeout in seconds (0=disabled)
keep_alive = contract.from_validator (fun x =>
if x >= 0 && x <= 600 then 'Ok
else 'Error {message = "keep_alive must be between 0 and 600"}
),
# Rate limiting max requests per window
rate_limit_requests = contract.from_validator (fun x =>
if x >= 10 && x <= 10000 then 'Ok
else 'Error {message = "rate_limit_requests must be between 10 and 10000"}
),
}