Documentation / zerotal / config-reexport / configLoader
Function: configLoader()
configLoader(
dir?):ConfigLoader
Defined in: packages/core/src/config/ConfigLoader.ts:89
Synchronously load every *.ts / *.js file in dir (default ./config) into a namespace map
keyed by filename. Safe to call at the top level of an entry script (zerotal.ts) — no await.
Each file's default export is the config object; an optional named validate(config)
export is collected and run by ConfigLoader.validate().
Parameters
dir?
string = "./config"
Directory to scan, relative to process.cwd(). Defaults to ./config.
Returns
A ConfigLoader over the discovered namespaces. A missing directory yields an empty loader rather than throwing.
Example
const config = configLoader("./config");
config.validate();
const app = Application.create({ config }); // or app.useConfig(config)