loadFromObject

View as MarkdownOpen in Claude

Load configuration from a plain object instead of a file. Useful for testing or programmatic setup. The file path is set to null. Returns this for method chaining.

Parameters

obj
Record<string, unknown>Required

The configuration object to use.

Returns

this — The ConfigLoader instance for chaining.

Example

1import { ConfigLoader } from '@signalwire/sdk';
2
3const config = new ConfigLoader();
4config.loadFromObject({
5 server: { port: 8080, host: '0.0.0.0' },
6 agent: { auto_answer: true },
7});
8
9console.log(config.get<number>('server.port')); // 8080
10console.log(config.getFilePath()); // null