106 lines
No EOL
2.5 KiB
TypeScript
106 lines
No EOL
2.5 KiB
TypeScript
// Main configuration exports
|
|
export {
|
|
initializeWcagConfig,
|
|
getWcagConfig,
|
|
getConfigValue,
|
|
hasConfigValue,
|
|
} from './config-instance';
|
|
|
|
// Schema exports
|
|
export { wcagAppConfigSchema, type WcagAppConfig } from './schemas/wcag-app.schema';
|
|
export { scannerConfigSchema, type ScannerConfig } from './schemas/scanner.schema';
|
|
export { workerConfigSchema, type WorkerConfig } from './schemas/worker.schema';
|
|
export { featuresConfigSchema, type FeaturesConfig } from './schemas/features.schema';
|
|
export { providersConfigSchema, type ProvidersConfig } from './schemas/providers.schema';
|
|
|
|
// Helper functions
|
|
import { getWcagConfig } from './config-instance';
|
|
import type { ScannerConfig, WorkerConfig, FeaturesConfig, ProvidersConfig } from './schemas';
|
|
|
|
/**
|
|
* Get scanner configuration
|
|
*/
|
|
export function getScannerConfig(): ScannerConfig {
|
|
return getWcagConfig().scanner;
|
|
}
|
|
|
|
/**
|
|
* Get worker configuration
|
|
*/
|
|
export function getWorkerConfig(): WorkerConfig {
|
|
return getWcagConfig().worker;
|
|
}
|
|
|
|
/**
|
|
* Get features configuration
|
|
*/
|
|
export function getFeaturesConfig(): FeaturesConfig {
|
|
return getWcagConfig().features;
|
|
}
|
|
|
|
/**
|
|
* Get providers configuration
|
|
*/
|
|
export function getProvidersConfig(): ProvidersConfig {
|
|
return getWcagConfig().providers;
|
|
}
|
|
|
|
/**
|
|
* Get service configuration
|
|
*/
|
|
export function getServiceConfig(service: 'api' | 'dashboard' | 'worker') {
|
|
return getWcagConfig().services[service];
|
|
}
|
|
|
|
/**
|
|
* Check if a feature is enabled
|
|
*/
|
|
export function isFeatureEnabled(feature: string): boolean {
|
|
const features = getFeaturesConfig();
|
|
const parts = feature.split('.');
|
|
|
|
let current: any = features;
|
|
for (const part of parts) {
|
|
if (typeof current !== 'object' || !(part in current)) {
|
|
return false;
|
|
}
|
|
current = current[part];
|
|
}
|
|
|
|
return current === true || (typeof current === 'object' && current.enabled === true);
|
|
}
|
|
|
|
/**
|
|
* Get database configuration
|
|
*/
|
|
export function getDatabaseConfig() {
|
|
return getWcagConfig().database;
|
|
}
|
|
|
|
/**
|
|
* Get Redis configuration for queues
|
|
*/
|
|
export function getRedisConfig() {
|
|
return getWcagConfig().worker.redis;
|
|
}
|
|
|
|
/**
|
|
* Get storage configuration
|
|
*/
|
|
export function getStorageConfig() {
|
|
return getWcagConfig().providers.storage;
|
|
}
|
|
|
|
/**
|
|
* Get compliance configuration
|
|
*/
|
|
export function getComplianceConfig() {
|
|
return getWcagConfig().compliance;
|
|
}
|
|
|
|
/**
|
|
* Get subscription tier configuration
|
|
*/
|
|
export function getSubscriptionConfig(tier: 'starter' | 'professional' | 'enterprise') {
|
|
return getWcagConfig().subscriptions.tiers[tier];
|
|
} |