/**
* Configuration Utilities
*
* @deprecated This class is deprecated. Use `appConfig` from `src/core/config` instead.
* This wrapper is kept for backward compatibility during migration.
*/
import { appConfig } from '../../core/config/config.js';
import { cdnUrlBuilder } from '../cdn/cdn-url-builder.js';
/**
* Configuration Utilities (Legacy wrapper)
*
* @deprecated Use `appConfig` from `src/core/config` instead
*/
export class ConfigUtil {
/**
* Get environment variable with default
* @deprecated Use appConfig directly
*/
getEnv(key: string, defaultValue: string = ''): string {
return process.env[key] || defaultValue;
}
/**
* Check if Late API is configured
*/
isLateAPIConfigured(): boolean {
return appConfig.isLateAPIConfigured();
}
/**
* Check if Instagram Late API is configured
*/
isInstagramLateConfigured(): boolean {
return appConfig.isInstagramLateConfigured();
}
/**
* Check if Pinterest Late API is configured
*/
isPinterestLateConfigured(): boolean {
return appConfig.isPinterestLateConfigured();
}
/**
* Check if Pinterest API is configured (PINTEREST_ACCESS_TOKEN and PINTEREST_BOARD_ID)
*/
isPinterestConfigured(): boolean {
const accessToken = process.env.PINTEREST_ACCESS_TOKEN || '';
const boardId = process.env.PINTEREST_BOARD_ID || '';
return !!(accessToken && boardId);
}
/**
* Get CDN base URL
*/
getCDNBaseURL(): string {
return appConfig.getCDNBaseURL();
}
/**
* Check if CDN is configured
*/
isCDNConfigured(): boolean {
return appConfig.isCDNConfigured();
}
/**
* Build full CDN URL from filename
* @deprecated Use cdnUrlBuilder.buildURL() instead
*/
buildCDNURL(filename: string): string {
return cdnUrlBuilder.buildURL(filename);
}
/**
* Build CDN URL with directory (post, story, pin)
* @deprecated Use cdnUrlBuilder.buildURLWithDirectory() instead
*/
buildCDNURLWithDirectory(filename: string, directory: 'post' | 'story' | 'pin'): string {
return cdnUrlBuilder.buildURLWithDirectory(filename, directory);
}
/**
* Build CDN URL for content generation (always uses 'story' directory)
* @deprecated Use cdnUrlBuilder.buildURLForContentGeneration() instead
*/
buildCDNURLForContentGeneration(filename: string): string {
return cdnUrlBuilder.buildURLForContentGeneration(filename);
}
/**
* Build CDN URL for publishing based on content type
* @deprecated Use cdnUrlBuilder.buildURLForPublishing() instead
*/
buildCDNURLForPublishing(
filename: string,
contentType: 'post' | 'story' | 'pin'
): string {
return cdnUrlBuilder.buildURLForPublishing(filename, contentType);
}
}
// Export singleton instance
export const configUtil = new ConfigUtil();