***

title: ConfigLoader
slug: /reference/typescript/agents/configuration/config-loader
description: JSON configuration file loader with environment variable interpolation and dot-notation access.
max-toc-depth: 3
---------------------

For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

[load]: /docs/server-sdks/reference/typescript/agents/configuration/config-loader/load

[search]: /docs/server-sdks/reference/typescript/agents/configuration/config-loader/search

[get]: /docs/server-sdks/reference/typescript/agents/configuration/config-loader/get

[has]: /docs/server-sdks/reference/typescript/agents/configuration/config-loader/has

[getall]: /docs/server-sdks/reference/typescript/agents/configuration/config-loader/get-all

[getfilepath]: /docs/server-sdks/reference/typescript/agents/configuration/config-loader/get-file-path

[loadfromobject]: /docs/server-sdks/reference/typescript/agents/configuration/config-loader/load-from-object

[set]: /docs/server-sdks/reference/typescript/agents/configuration/config-loader/set

`ConfigLoader` loads JSON configuration files and substitutes environment
variables using `${VAR|default}` syntax. It provides dot-notation access
for nested values and supports method chaining.

```typescript {3}
import { ConfigLoader } from '@signalwire/sdk';

const config = new ConfigLoader('./config.json');
const port = config.get<number>('server.port', 3000);
```

## **Constructor**

<ParamField path="filePath" type="string" toc={true}>
  Path to a JSON config file to load on construction. If omitted, use
  [`load()`][load] or [`loadFromObject()`][loadfromobject] later.
</ParamField>

## **Methods**

<CardGroup cols={3}>
  <Card title="load" href="/docs/server-sdks/reference/typescript/agents/configuration/config-loader/load">
    Load configuration from a JSON file with env var interpolation.
  </Card>

  <Card title="search" href="/docs/server-sdks/reference/typescript/agents/configuration/config-loader/search">
    Static method to find and load a config file from standard locations.
  </Card>

  <Card title="get" href="/docs/server-sdks/reference/typescript/agents/configuration/config-loader/get">
    Get a value by dot-notation path.
  </Card>

  <Card title="set" href="/docs/server-sdks/reference/typescript/agents/configuration/config-loader/set">
    Set a value at a dot-notation path.
  </Card>

  <Card title="has" href="/docs/server-sdks/reference/typescript/agents/configuration/config-loader/has">
    Check whether a dot-notation path exists.
  </Card>

  <Card title="getAll" href="/docs/server-sdks/reference/typescript/agents/configuration/config-loader/get-all">
    Return a shallow copy of the entire configuration object.
  </Card>

  <Card title="getFilePath" href="/docs/server-sdks/reference/typescript/agents/configuration/config-loader/get-file-path">
    Return the absolute path of the loaded config file.
  </Card>

  <Card title="loadFromObject" href="/docs/server-sdks/reference/typescript/agents/configuration/config-loader/load-from-object">
    Load configuration from a plain object instead of a file.
  </Card>
</CardGroup>

## **Example**

```typescript {4,7-8}
import { ConfigLoader } from '@signalwire/sdk';

// Load from a specific file
const config = new ConfigLoader('./config.json');
console.log('File:', config.getFilePath());

const port = config.get<number>('server.port', 3000);
const host = config.get<string>('server.host', '0.0.0.0');
console.log(`Listening on ${host}:${port}`);
```