find_config_file

View as MarkdownOpen in Claude

find_config_file (static)

ConfigLoader.find_config_file(service_name=None, additional_paths=None) -> Optional[str]

Static method to locate a config file without loading it.

Parameters

service_name
str

Optional service name. When provided, the method also checks for {service_name}_config.json and .swml/{service_name}_config.json.

additional_paths
list[str]

Additional file paths to check before the default search paths.

Returns

Optional[str] — Path to the first config file found, or None.

Example

1from signalwire.core.config_loader import ConfigLoader
2
3# Find config for the MCP service
4path = ConfigLoader.find_config_file(service_name="mcp")
5# Checks: mcp_config.json, .swml/mcp_config.json, config.json, ...
6print(f"Found: {path}")
7
8# Find with extra paths
9path = ConfigLoader.find_config_file(
10 additional_paths=["/opt/myapp/config.json"]
11)
12print(f"Found: {path}")