load

View as MarkdownOpen in Claude

Load configuration from a JSON file, performing ${VAR|default} environment variable interpolation on the raw text before parsing. Returns this for method chaining.

Parameters

filePath
stringRequired

Path to the JSON config file. Resolved to an absolute path internally. Throws an error if the file does not exist.

Returns

this — The ConfigLoader instance for chaining.

Example

1import { ConfigLoader } from '@signalwire/sdk';
2
3const config = new ConfigLoader();
4config.load('./config.json');
5
6const port = config.get<number>('server.port', 3000);
7console.log('Port:', port);