The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Allow s3 credentials via env (#6066)
brendanlaschkeafb3f4b7b7a8
diff --git a/packages/twenty-server/src/engine/integrations/environment/environment-variables.ts b/packages/twenty-server/src/engine/integrations/environment/environment-variables.tsindex 7bff532c4c1..423dee3b31a 100644--- a/packages/twenty-server/src/engine/integrations/environment/environment-variables.ts+++ b/packages/twenty-server/src/engine/integrations/environment/environment-variables.ts@@ -220,6 +220,16 @@ export class EnvironmentVariables {@IsOptional()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()@ValidateIf((env) => env.STORAGE_TYPE === StorageDriverType.Local)STORAGE_LOCAL_PATH = '.local-storage';diff --git a/packages/twenty-server/src/engine/integrations/file-storage/file-storage.module-factory.ts b/packages/twenty-server/src/engine/integrations/file-storage/file-storage.module-factory.tsindex f846dc96df8..b1ab03642ef 100644--- a/packages/twenty-server/src/engine/integrations/file-storage/file-storage.module-factory.ts+++ b/packages/twenty-server/src/engine/integrations/file-storage/file-storage.module-factory.ts@@ -32,15 +32,24 @@ export const fileStorageModuleFactory = async (const bucketName = environmentService.get('STORAGE_S3_NAME');const endpoint = environmentService.get('STORAGE_S3_ENDPOINT');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 {type: StorageDriverType.S3,options: {bucketName: bucketName ?? '',endpoint: endpoint,- credentials: fromNodeProviderChain({- clientConfig: { region },- }),+ credentials: accessKeyId+ ? {+ accessKeyId,+ secretAccessKey,+ }+ : fromNodeProviderChain({+ clientConfig: { region },+ }),forcePathStyle: true,region: region ?? '',},diff --git a/packages/twenty-website/src/content/developers/self-hosting/self-hosting-var.mdx b/packages/twenty-website/src/content/developers/self-hosting/self-hosting-var.mdxindex 88ae2e5119e..7d50e1a083d 100644--- a/packages/twenty-website/src/content/developers/self-hosting/self-hosting-var.mdx+++ b/packages/twenty-website/src/content/developers/self-hosting/self-hosting-var.mdx@@ -142,6 +142,8 @@ yarn command:prod cron:calendar:google-calendar-sync['STORAGE_S3_REGION', '', 'Storage Region'],['STORAGE_S3_NAME', '', 'Bucket Name'],['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)'],]}></ArticleTable>