Loading the config never opens a connection. An application composes a runtime explicitly, in three steps:
1
2
3
4
5
6
7
8
9
10
11
12
import { createLakeQLRuntime, loadConfig } from "@lakeql/config"
const project = await loadConfig() // load + validate
const runtime = await createLakeQLRuntime({
// compose
config: project.config,
adapters: project.adapters,
resolveAuth,
})
// ... use runtime.getDataSource(name) / getReadStrategy(name)
await runtime.close() // release on shutdown
-
Load
—
loadConfigreads the config. Environment values are read by the config module itself as it is evaluated. Per-source validation against the adapter happens indefineConfig(at module evaluation) and again in the adapter factory when the data source is created — not inloadConfigitself. -
Compose
—
createLakeQLRuntimebuilds the runtime, which owns the data-source instances and their strategies. -
Close
—
runtime.close()releases all connections, once, idempotently.
Nothing is global, so an application can hold more than one runtime. That helps with config reloads (compose the new runtime, then close the old) and tests.
For the full contract, options, and error cases, see the runtime config reference in @lakeql/config. Wire close() to your process signals as shown in server setup.