Files
directus/api/src/storage/register-locations.ts
Rijk van Zanten 80f4807a09 TS Config Modernization Program Part 3 of many (#17904)
* noImplicitOverride: true

* noImplicitReturns: true

* noPropertyAccessFromIndexSignature: true
2023-03-23 16:47:55 -04:00

20 lines
695 B
TypeScript

// @ts-expect-error https://github.com/microsoft/TypeScript/issues/49721
import type { StorageManager } from '@directus/storage';
import { toArray } from '@directus/shared/utils';
import { getEnv } from '../env';
import { getConfigFromEnv } from '../utils/get-config-from-env';
export const registerLocations = async (storage: StorageManager) => {
const env = getEnv();
const locations = toArray(env['STORAGE_LOCATIONS']);
locations.forEach((location: string) => {
location = location.trim();
const driverConfig = getConfigFromEnv(`STORAGE_${location.toUpperCase()}_`);
const { driver, ...options } = driverConfig;
storage.registerLocation(location, { driver, options });
});
};