ConfigSwitcherExtensionParams
Extension methods defined in the middleware config-switcher configuration.
interface ConfigSwitcherExtensionParams<TIntegrationConfig extends IntegrationConfig = IntegrationConfig> {
cacheTTL?: number;
configuration: (() => Promise<Record<ConfigId, DeepPartial<TIntegrationConfig>>>) | Record<ConfigId, DeepPartial<TIntegrationConfig>>;
defaultHeaderValue?: string;
switchStrategy?: {
resolveConfigId: ConfigIdResolver;
} | BuiltInStategyName;
}Properties
| Name | Required | Type | Description |
|---|---|---|---|
cacheTTL | Optional | number | Configuration cache TTL in seconds. Determines how long the configuration data is cached in memory. This helps in optimizing performance by reducing the need to fetch configuration data on every request. 10 |
configuration | Required | (() => Promise<Record<ConfigId, DeepPartial<TIntegrationConfig>>>) | Record<ConfigId, DeepPartial<TIntegrationConfig>> | Configuration map or function returning configuration map. The configuration can be provided directly as an object or as an async function. This allows for dynamic fetching of configuration data, such as from an API. |
defaultHeaderValue | Optional | string | Default header value to use when the x-alokai-middleware-config-id header is not present. This is only used when the switchStrategy is set to 'header'. 'default' |
switchStrategy | Optional | { resolveConfigId: ConfigIdResolver; } | BuiltInStategyName | Strategy for resolving configuration key. Can be either a built-in strategy name or a custom resolver object. 'header' |