find_config_file

View as MarkdownOpen in Claude

find_config_file (static)

ConfigLoader.find_config_file(service_name=None, additional_paths=None) -> str | None

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

str | None — Path to the first config file found, or None.

Example

from signalwire.core.config_loader import ConfigLoader
# Find config for the MCP service
path = ConfigLoader.find_config_file(service_name="mcp")
# Checks: mcp_config.json, .swml/mcp_config.json, config.json, ...
print(f"Found: {path}")
# Find with extra paths
path = ConfigLoader.find_config_file(
additional_paths=["/opt/myapp/config.json"]
)
print(f"Found: {path}")