Skip to main content
Glama
ConfigurationProviderImpl.ts1.5 kB
/** * Configuration Provider Implementation * Provides centralized configuration management for managers */ import type { WordPressClientConfig } from "@/types/client.js"; import type { ConfigurationProvider } from "@/client/managers/interfaces/ManagerInterfaces.js"; export class ConfigurationProviderImpl implements ConfigurationProvider { public readonly config: WordPressClientConfig; constructor(config: WordPressClientConfig) { // Create defensive copy to prevent external mutation this.config = Object.freeze({ ...config }); } /** * Get configuration value by path (dot notation) */ getConfigValue<T = unknown>(path: string, defaultValue?: T): T | undefined { return ( (path.split(".").reduce((obj, key) => (obj as Record<string, unknown>)?.[key], this.config as unknown) as T) ?? defaultValue ); } /** * Validate configuration completeness */ validateConfiguration(): void { const required = ["baseUrl", "auth"]; const missing = required.filter((field) => !this.config[field as keyof WordPressClientConfig]); if (missing.length > 0) { throw new Error(`Missing required configuration: ${missing.join(", ")}`); } } /** * Get timeout value with fallbacks */ getTimeout(): number { return this.config.timeout || 30000; } /** * Check if debug mode is enabled */ isDebugEnabled(): boolean { return Boolean((this.config as unknown as Record<string, unknown>).debug); } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/docdyhr/mcp-wordpress'

If you have feedback or need assistance with the MCP directory API, please join our Discord server