For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Log inSign up
Support
GuidesReference
GuidesReference
    • Core
      • Overview
    • Agents
      • Overview
      • AgentBase
      • AgentServer
      • Configuration
        • AuthHandler
        • ConfigLoader
          • findConfigFile
          • get
          • getAll
          • getConfig
          • getConfigFile
          • getFilePath
          • getSection
          • has
          • hasConfig
          • interpolateEnvVars
          • load
          • loadFromObject
          • mergeWithEnv
          • search
          • set
          • substituteVars
        • Environment Variables
        • Logging
        • PromptManager
        • SchemaUtils
        • ServerlessAdapter
        • SessionManager
        • SslConfig
      • ContextBuilder
      • DataMap
      • FunctionResult
      • Helper Functions & Utilities
      • LiveWire
      • PomBuilder
      • Prefabs
      • SkillBase
      • SkillManager
      • SkillRegistry
      • Skills
      • SwaigFunction
      • SwmlBuilder
      • SWMLService
    • RELAY
      • Overview
      • Actions
      • Call
      • Constants
      • Events
      • Message
      • RelayClient
      • RelayError
    • REST Client
      • Overview
      • Addresses
      • Calling
      • ChatResource
      • Compat
      • Datasphere
      • Fabric
      • ImportedNumbersResource
      • Logs
      • LookupResource
      • MFA
      • Number Groups
      • Phone Numbers
      • Project
      • PubSubResource
      • Queues
      • Recordings
      • Registry
      • RestClient
      • RestError
      • Short Codes
      • SIP Profile
      • Verified Callers
      • Video
LogoLogoSignalWire Docs
Log inSign up
Support
On this page
  • Constructor
  • Properties
  • Methods
  • Example
AgentsConfiguration

ConfigLoader

|View as Markdown|Open in Claude|
Was this page helpful?
Edit this page
Previous

findConfigFile

Next
Built with

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.

1import { ConfigLoader } from '@signalwire/sdk';
2
3const config = new ConfigLoader('./config.json');
4const port = config.get<number>('server.port', 3000);

Constructor

filePaths
string | string[]

Path(s) to a JSON config file to load on construction. A single string is loaded directly; an array is searched in order and the first existing file is loaded (mirroring the Python SDK’s ordered-search behaviour). If no file in the array exists, the paths are recorded but no error is thrown. If omitted, use load() or loadFromObject() later.

Properties

configPaths
string[]

The ordered list of config file paths passed to the constructor or searched during loading. Returns a defensive copy.

Methods

load

Load configuration from a JSON file with env var interpolation.

search

Static method to find and load a config file from standard locations.

get

Get a value by dot-notation path.

set

Set a value at a dot-notation path.

has

Check whether a dot-notation path exists.

getAll

Return a shallow copy of the entire configuration object.

getFilePath

Return the absolute path of the loaded config file.

loadFromObject

Load configuration from a plain object instead of a file.

findConfigFile

Find a config file without loading it (static).

getConfig

Return the full config (Python-compat alias for getAll).

getConfigFile

Return the loaded file path (Python-compat alias for getFilePath).

hasConfig

Check whether any configuration data is loaded.

getSection

Get a top-level section with env-var substitution.

substituteVars

Recursively substitute ${VAR} references with coercion.

mergeWithEnv

Merge config with prefixed environment variables.

interpolateEnvVars

Interpolate ${VAR} in a raw string without coercion.

Example

1import { ConfigLoader } from '@signalwire/sdk';
2
3// Load from a specific file
4const config = new ConfigLoader('./config.json');
5console.log('File:', config.getFilePath());
6
7const port = config.get<number>('server.port', 3000);
8const host = config.get<string>('server.host', '0.0.0.0');
9console.log(`Listening on ${host}:${port}`);