@ -220,6 +220,16 @@ export class EnvironmentVariables {
|
|||||||
@IsOptional()
|
@IsOptional()
|
||||||
STORAGE_S3_ENDPOINT: string;
|
STORAGE_S3_ENDPOINT: string;
|
||||||
|
|
||||||
|
@ValidateIf((env) => env.STORAGE_TYPE === StorageDriverType.S3)
|
||||||
|
@IsString()
|
||||||
|
@IsOptional()
|
||||||
|
STORAGE_S3_ACCESS_KEY_ID: string;
|
||||||
|
|
||||||
|
@ValidateIf((env) => env.STORAGE_TYPE === StorageDriverType.S3)
|
||||||
|
@IsString()
|
||||||
|
@IsOptional()
|
||||||
|
STORAGE_S3_SECRET_ACCESS_KEY: string;
|
||||||
|
|
||||||
@IsString()
|
@IsString()
|
||||||
@ValidateIf((env) => env.STORAGE_TYPE === StorageDriverType.Local)
|
@ValidateIf((env) => env.STORAGE_TYPE === StorageDriverType.Local)
|
||||||
STORAGE_LOCAL_PATH = '.local-storage';
|
STORAGE_LOCAL_PATH = '.local-storage';
|
||||||
|
|||||||
@ -32,15 +32,24 @@ export const fileStorageModuleFactory = async (
|
|||||||
const bucketName = environmentService.get('STORAGE_S3_NAME');
|
const bucketName = environmentService.get('STORAGE_S3_NAME');
|
||||||
const endpoint = environmentService.get('STORAGE_S3_ENDPOINT');
|
const endpoint = environmentService.get('STORAGE_S3_ENDPOINT');
|
||||||
const region = environmentService.get('STORAGE_S3_REGION');
|
const region = environmentService.get('STORAGE_S3_REGION');
|
||||||
|
const accessKeyId = environmentService.get('STORAGE_S3_ACCESS_KEY_ID');
|
||||||
|
const secretAccessKey = environmentService.get(
|
||||||
|
'STORAGE_S3_SECRET_ACCESS_KEY',
|
||||||
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
type: StorageDriverType.S3,
|
type: StorageDriverType.S3,
|
||||||
options: {
|
options: {
|
||||||
bucketName: bucketName ?? '',
|
bucketName: bucketName ?? '',
|
||||||
endpoint: endpoint,
|
endpoint: endpoint,
|
||||||
credentials: fromNodeProviderChain({
|
credentials: accessKeyId
|
||||||
clientConfig: { region },
|
? {
|
||||||
}),
|
accessKeyId,
|
||||||
|
secretAccessKey,
|
||||||
|
}
|
||||||
|
: fromNodeProviderChain({
|
||||||
|
clientConfig: { region },
|
||||||
|
}),
|
||||||
forcePathStyle: true,
|
forcePathStyle: true,
|
||||||
region: region ?? '',
|
region: region ?? '',
|
||||||
},
|
},
|
||||||
|
|||||||
@ -142,6 +142,8 @@ yarn command:prod cron:calendar:google-calendar-sync
|
|||||||
['STORAGE_S3_REGION', '', 'Storage Region'],
|
['STORAGE_S3_REGION', '', 'Storage Region'],
|
||||||
['STORAGE_S3_NAME', '', 'Bucket Name'],
|
['STORAGE_S3_NAME', '', 'Bucket Name'],
|
||||||
['STORAGE_S3_ENDPOINT', '', 'Use if a different Endpoint is needed (for example Google)'],
|
['STORAGE_S3_ENDPOINT', '', 'Use if a different Endpoint is needed (for example Google)'],
|
||||||
|
['STORAGE_S3_ACCESS_KEY_ID', '', 'Optional depending on the authentication method'],
|
||||||
|
['STORAGE_S3_SECRET_ACCESS_KEY', '', 'Optional depending on the authentication method'],
|
||||||
['STORAGE_LOCAL_PATH', '.local-storage', 'data path (local storage)'],
|
['STORAGE_LOCAL_PATH', '.local-storage', 'data path (local storage)'],
|
||||||
]}></ArticleTable>
|
]}></ArticleTable>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user