/** * Feature Flag Configuration * * Configuration integration for feature flags with environment variable support. * Imports configuration from .env.local and provides validation. * */ import { type CoreFeatureFlagEnvironmentConfig } from '@plyaz/types/core'; import type { FeatureFlagConfigOptions as _FeatureFlagConfigOptions } from '@plyaz/types/features'; /** * Feature flag configuration factory * * This factory is the FIRST component called during application startup. * It reads environment variables from .env.local and creates a validated configuration object. * * @example * ```typescript * // Step 1: Called automatically by FeatureFlagService.onModuleInit() * const config = FeatureFlagConfigFactory.fromOptions({ environment: Core.env.NODE_ENV }); * * // Step 2: Configuration is validated * // Step 3: Provider is created with this config * const provider = FeatureFlagProviderFactory.create(config, FEATURES); * ``` * * @example Environment Variables (.env.local) * ```bash * SUPABASE_URL=https://your-project.supabase.co * SUPABASE_ANON_PUBLIC_KEY=your-anon-key * FEATURE_FLAG_PROVIDER=database * FEATURE_FLAG_CACHE_ENABLED=true * FEATURE_FLAG_CACHE_TTL=300 * FEATURE_FLAG_TABLE_NAME=feature_flags * ``` */ export declare class FeatureFlagConfigFactory { /** * Creates configuration from environment variables * * **EXECUTION ORDER: This is called FIRST in the initialization chain** * * Flow: * 1. NestJS starts → FeatureFlagModule loads * 2. FeatureFlagService.onModuleInit() called * 3. → initializeProvider() called * 4. → **THIS METHOD CALLED** ← YOU ARE HERE * 5. → Configuration validated * 6. → Provider created and initialized * 7. → Database connection established * * @returns Validated configuration object ready for provider creation * @throws {FeatureFlagConfigError} If required options are missing or invalid */ /** * Creates configuration from explicit options * * All options have sensible defaults - only provide what you need to override. * Environment is automatically read from Core.env.NODE_ENV. * * Note: For 'database' provider, DbService must be initialized first via Core.initialize(). * The database provider uses the already-configured DbService, no connection string needed here. * * @example Basic usage with defaults (memory provider) * ```typescript * const config = FeatureFlagConfigFactory.fromOptions(); * // Uses memory provider, cache enabled, default TTL * ``` * * @example Database provider (requires Core.initialize() first) * ```typescript * // First: Core.initialize() with db config * await Core.initialize({ db: { adapter: 'sql', sql: { connectionString: '...' } } }); * * // Then: Use database provider for feature flags * const config = FeatureFlagConfigFactory.fromOptions({ provider: 'database' }); * ``` * * @example Custom cache settings * ```typescript * const config = FeatureFlagConfigFactory.fromOptions({ * cacheEnabled: true, * cacheTtl: 600, // 10 minutes * refreshInterval: 30, * }); * ``` */ static fromOptions(options?: _FeatureFlagConfigOptions): CoreFeatureFlagEnvironmentConfig; } //# sourceMappingURL=feature-flag.config.d.ts.map