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
  • Parameters
  • Returns
  • Example
AgentsConfigurationConfigLoader

findConfigFile

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

get

Next
Built with

Static helper that searches for a config file and returns the first match’s absolute path without loading it. Useful for detecting whether a configuration exists before deciding whether to instantiate a ConfigLoader. For searching from an instance that also loads on match, use search() instead.

The search order is:

  1. {serviceName}_config.json (cwd) and .swml/{serviceName}_config.json (if serviceName)
  2. Each path in additionalPaths (if provided)
  3. config.json
  4. agent_config.json
  5. .swml/config.json
  6. ~/.swml/config.json
  7. /etc/swml/config.json

Parameters

serviceName
string | undefined

Service name. When provided, service-specific config filenames are checked before defaults.

additionalPaths
string[] | undefined

Extra file paths to check between service-specific and default locations.

Returns

string | null — absolute path of the first existing config file, or null if none match.

Example

1import { ConfigLoader } from '@signalwire/sdk';
2
3const path = ConfigLoader.findConfigFile('my-service');
4if (path) {
5 const loader = new ConfigLoader(path);
6 console.log(`Loaded from ${loader.getFilePath()}`);
7} else {
8 console.log('No config file found');
9}