diff --git a/libs/server/store/index.ts b/libs/server/store/index.ts index 432025ccd..c22884a7e 100644 --- a/libs/server/store/index.ts +++ b/libs/server/store/index.ts @@ -3,8 +3,8 @@ import { StoreS3 } from './providers/s3' export function createStore() { return new StoreS3({ - accessKey: getEnv('STORE_ACCESS_KEY', undefined, true), - secretKey: getEnv('STORE_SECRET_KEY', undefined, true), + accessKey: getEnv('STORE_ACCESS_KEY'), + secretKey: getEnv('STORE_SECRET_KEY'), endPoint: getEnv('STORE_END_POINT'), bucket: getEnv('STORE_BUCKET', 'notea'), region: getEnv('STORE_REGION', 'us-east-1'), diff --git a/libs/server/store/providers/s3.ts b/libs/server/store/providers/s3.ts index bc5cf7bf4..faf1cf02d 100644 --- a/libs/server/store/providers/s3.ts +++ b/libs/server/store/providers/s3.ts @@ -40,11 +40,14 @@ export class StoreS3 extends StoreProvider { forcePathStyle: config.pathStyle, region: config.region, endpoint: config.endPoint, - credentials: { + credentials: ((config.accessKey && config.secretKey) ? { accessKeyId: config.accessKey, secretAccessKey: config.secretKey, - }, + }: undefined), }) + if (!config.accessKey || !config.secretKey) { + console.log('[Notea] Environment variables STORE_ACCESS_KEY or STORE_SECRET_KEY is missing. Trying to use IAM role credentials instead ...') + } this.config = config }