For AI agents: the complete documentation index is available at /hclapi/llms.txt, the full documentation bundle is available at /hclapi/llms-full.txt, and this page is available as Markdown at /hclapi/docs/manifest/connection.md.

connection

The connection block declares external pools for relational databases and key-value stores.

SQL connections

hclapi uses canonical SQL engine names:

connection "sql" "main" {
  engine = "postgres"
  source = "postgres://user:pass@localhost:5432/app?sslmode=disable"
  pool {
    max_open = 25
    max_idle = 25
  }
}

Supported engines

EngineDialect placeholderGo driver package
postgres@parampgx/v5
mysql@paramgo-sql-driver
sqlite@parammodernc.org/sqlite
sqlserver@paramgo-mssqldb

Non-canonical engine names (like postgresql, sqlite3, mariadb, or mssql) are rejected at compile time so manifests remain consistent.

Pool settings

AttributeTypeDefaultDescription
max_openint25Maximum active open connections in the pool
max_idleint25Maximum idle connections waiting in the pool

Idle connections are recycled after 5 minutes, and connection lifetime is bounded to 15 minutes.

Valkey and Redis connections

connection "valkey" "cache" {
  url = "redis://127.0.0.1:6379/0"
}
AttributeTypeRequiredDescription
urlstringyesConnection URL (redis://..., valkey://..., or rediss://)
sourcestringoptionalAlternative alias for url