// This is a bconf file
extends "./base.bconf"
import from "./secrets.bconf" { $db_user, $db_pass as $database_password }
$app_name = "An awesome app"
$env = env("APP_ENV")
app {
name = $app_name
environment = $env
features {
auth
}
}
server.http.host = "0.0.0.0"
server.http.port = int(env("PORT"))
server.tls {
enabled
cert_file = "/etc/ssl/certs/app.crt"
key_file = "/etc/ssl/private/app.key"
}
database.primary {
host = "primary.db.internal"
user = $db_user
pass = $database_password
pool_size = int(env("DB_POOL_SIZE"))
}
database.replicas = [
{ host = "replica1.db.internal", user = $db_user },
{ host = "replica2.db.internal", user = $db_user }
]
database.replicas[0].read_only = true
database.replicas[1].read_only = false
plugins << {
name = "authentication"
config {
jwt_secret = env("JWT_SECRET")
token_expiry = "1h"
}
}
plugins << {
name = "cors"
config {
allowed_origins = ["https://app.example.com", "https://admin.example.com"]
}
}
api_docs_header = """
Welcome to the API for ${$app_name}.
Host: ${ref(server.http.host)}:${ref(server.http.port)}
Environment: ${$env}
"""
export vars {
$env
$app_name as $name
} Human Readable
bconf offers a clean, familiar syntax that is easy to read and learn. The syntax and concepts should be familiar to anyone who has programmed, leveraging common constructs found in other formats and programming languages
Scalable
Modularity is at the core of bconf, with support for variables and extending other documents. Deeply nested keys can be defined inline, making it easy to scale and maintain larger files
Easy to enhance
Features like statements and tags use a generic syntax, allowing you to define your own custom logic and structures to enhance configurations as your application requires