Skip to content

Config Module

Overview

The Config module centralises configuration management for the BidScript application. It provides a standardised way to access environment variables, feature flags, and other configuration settings throughout the application.

Key Components

Config Module

The main module that registers configuration providers:

@Module({
  imports: [
    // Dependencies
  ],
  providers: [
    // Configuration services
  ],
  exports: [
    // Exported services
  ],
})
export class ConfigModule {}

Model Config

The module includes model configurations for AI services:

// Example model configuration
export enum ModelType {
  GPT_4 = "gpt-4",
  GPT_35_TURBO = "gpt-35-turbo",
  GPT_4_TURBO = "gpt-4-turbo",
  CLAUDE_3_5_SONNET = "claude-3-5-sonnet",
  CLAUDE_3_7_SONNET = "claude-3-7-sonnet",
  // Other models...
}

Feature Flags

The module can manage feature flags for conditional functionality:

// Example feature flag configuration
export interface FeatureFlags {
  enableRagSearch: boolean;
  enableCollaboration: boolean;
  enableAdvancedParsing: boolean;
  maxDocumentSize: number;
}

Integration with Other Modules

The Config module is imported by almost all other modules to access configuration settings:

  • Azure Module: For API keys and service configurations
  • Authentication Module: For security settings
  • Database Modules: For connection information
  • AI Services: For model configurations

Environment Variables

The module manages various environment variables, including:

  • API keys for external services
  • Database connection strings
  • Feature toggles
  • Environment-specific settings

Usage Example

@Injectable()
export class SomeService {
  constructor(private configService: ConfigService) {}

  async someMethod() {
    const apiKey = this.configService.get<string>("API_KEY");
    const featureEnabled = this.configService.get<boolean>("FEATURE_ENABLED");

    if (featureEnabled) {
      // Do something with the API key
    }
  }
}

Benefits

  • Centralised configuration management
  • Environment-specific settings
  • Type-safe configuration access
  • Default values for missing configurations
  • Configuration validation