# ¸_¸ ¸_¸ ¸__¸ ¸_______ __¸
# ┊ ╲┊ ┊╱ ╲┊ ┊ ┊
# ┊ ` ┊ )( ┊ ┊ ┊ ┊ ┊___¸
# ┊__╲__┊╲____╱┊__┊_┊__┊______┊
# Configuration Example using NOML markup
# High-performance config example with advanced
# features
# Minimize overhead
# Basic configuration (TOML-compatible)
#
#
#
[app]
name = "MyApp"
version = "1.0.0"
debug = false
[server]
host = "localhost"
port = 8080
# Production override
# host = "0.0.0.0" # Uncomment for production
# Environment variables
[database]
url = env("DATABASE_URL", "sqlite://local.db")
max_connections = env("DB_MAX_CONN", 10)
password = env("DB_PASSWORD") # Required env var
# Variable interpolation
[paths]
base = "/var/app"
logs = "${paths.base}/logs"
uploads = "${paths.base}/uploads"
config = "${paths.base}/config/${app.name}.conf"
# Imports (modular configs)
include "database.noml"
include "features/${app.name}.noml"
# Advanced nested objects
[services]
redis = {
host = "localhost",
port = 6379,
db = 0
}
cache = {
type = "redis",
ttl = 3600,
servers = ["${services.redis.host}:${services.redis.port}"]
}
# Arrays with computed values
[monitoring]
endpoints = [
"http://${server.host}:${server.port}/health",
"http://${server.host}:${server.port}/metrics"
]
# Schema validation (built-in types)
[limits]
max_file_size = @size("10MB") # Native size type
created_at = @date("2024-01-01") # Native date type
timeout = @duration("30s") # Native duration type
# Computed values
[stats]
items = [
{ name = "item1", price = 10.50 },
{ name = "item2", price = 25.00 },
{ name = "item3", price = 15.75 }
]
total_price = sum(stats.items.*.price) # Computed: 51.25
item_count = len(stats.items) # Computed: 3
# Conditional configuration
[features]
analytics = env("ENABLE_ANALYTICS", false)
premium_features = ${app.version} >= "2.0.0"
# References to other sections
[deployment]
database_config = @ref(database) # Reference to entire database section
log_path = @ref(paths.logs) # Reference to specific valuenoml-lang/noml
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|