mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-18 00:15:30 +01:00
* chore: linting for `loadCustomConfig` * refactor: decouple CDN init and variable/health checks from AppService * refactor: move AppService to packages/data-schemas * chore: update AppConfig import path to use data-schemas * chore: update JsonSchemaType import path to use data-schemas * refactor: update UserController to import webSearchKeys and redefine FunctionTool typedef * chore: remove AppService.js * refactor: update AppConfig interface to use Partial<TCustomConfig> and make paths and fileStrategies optional * refactor: update checkConfig function to accept Partial<TCustomConfig> * chore: fix types * refactor: move handleRateLimits to startup checks as is an effect * test: remove outdated rate limit tests from AppService.spec and add new handleRateLimits tests in checks.spec
26 lines
993 B
TypeScript
26 lines
993 B
TypeScript
import { logger } from '@librechat/data-schemas';
|
|
import { FileSources } from 'librechat-data-provider';
|
|
import type { AppConfig } from '@librechat/data-schemas';
|
|
import { initializeAzureBlobService } from '~/cdn/azure';
|
|
import { initializeFirebase } from '~/cdn/firebase';
|
|
import { initializeS3 } from '~/cdn/s3';
|
|
|
|
/**
|
|
* Initializes file storage clients based on the configured file strategy.
|
|
* This should be called after loading the app configuration.
|
|
* @param {Object} options
|
|
* @param {AppConfig} options.appConfig - The application configuration
|
|
*/
|
|
export function initializeFileStorage(appConfig: AppConfig) {
|
|
const { fileStrategy } = appConfig;
|
|
|
|
if (fileStrategy === FileSources.firebase) {
|
|
initializeFirebase();
|
|
} else if (fileStrategy === FileSources.azure_blob) {
|
|
initializeAzureBlobService().catch((error) => {
|
|
logger.error('Error initializing Azure Blob Service:', error);
|
|
});
|
|
} else if (fileStrategy === FileSources.s3) {
|
|
initializeS3();
|
|
}
|
|
}
|