Add required settings for object-persistor

This commit is contained in:
Simon Detheridge 2020-07-23 19:42:20 +01:00
parent 287d705671
commit 812c996c47

View file

@ -17,8 +17,15 @@ const Settings = {
mongo: {},
docstore: {
backend: process.env.BACKEND || 's3',
healthCheck: {
project_id: process.env.HEALTH_CHECK_PROJECT_ID
},
bucket: process.env.BUCKET_NAME || 'bucket',
gcs: {
unlockBeforeDelete: process.env.GCS_UNLOCK_BEFORE_DELETE === 'true',
deletedBucketSuffix: process.env.GCS_DELETED_BUCKET_SUFFIX,
deleteConcurrency: parseInt(process.env.GCS_DELETE_CONCURRENCY) || 50
}
},
@ -41,7 +48,28 @@ if (
Settings.docstore.s3 = {
key: process.env.AWS_ACCESS_KEY_ID,
secret: process.env.AWS_SECRET_ACCESS_KEY,
bucket: process.env.AWS_BUCKET
bucket: process.env.AWS_BUCKET,
endpoint: process.env.AWS_S3_ENDPOINT,
pathStyle: process.env.AWS_S3_PATH_STYLE,
partSize: parseInt(process.env.AWS_S3_PARTSIZE) || 100 * 1024 * 1024
}
}
if (process.env.GCS_API_ENDPOINT) {
Settings.docstore.gcs.endpoint = {
apiEndpoint: process.env.GCS_API_ENDPOINT,
apiScheme: process.env.GCS_API_SCHEME,
projectId: process.env.GCS_PROJECT_ID
}
}
if (process.env.FALLBACK_BACKEND) {
Settings.docstore.fallback = {
backend: process.env.FALLBACK_BACKEND,
// mapping of bucket names on the fallback, to bucket names on the primary.
// e.g. { myS3UserFilesBucketName: 'myGoogleUserFilesBucketName' }
buckets: JSON.parse(process.env.FALLBACK_BUCKET_MAPPING || '{}'),
copyOnMiss: process.env.COPY_ON_MISS === 'true'
}
}