mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Add S3 options: httpOptions, maxRetries
This commit is contained in:
parent
82ec8d21a4
commit
6521837993
3 changed files with 23 additions and 0 deletions
|
@ -264,6 +264,8 @@ For the `FS` persistor, the `bucketName` should be the full path to the folder o
|
||||||
- `s3.key` (required): The AWS access key ID
|
- `s3.key` (required): The AWS access key ID
|
||||||
- `s3.secret` (required): The AWS secret access key
|
- `s3.secret` (required): The AWS secret access key
|
||||||
- `s3.partSize`: The part size for S3 uploads. Defaults to 100 megabytes.
|
- `s3.partSize`: The part size for S3 uploads. Defaults to 100 megabytes.
|
||||||
|
- `s3.httpOptions`: HTTP options passed directly to the [S3 constructor](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#constructor-property).
|
||||||
|
- `s3.maxRetries`: The number of times the S3 client will retry in case of an error
|
||||||
- `s3.endpoint`: For testing - overrides the S3 endpoint to use a different service (e.g. a fake S3 server)
|
- `s3.endpoint`: For testing - overrides the S3 endpoint to use a different service (e.g. a fake S3 server)
|
||||||
- `s3.pathStyle`: For testing - use old path-style URLs, for services that do not support subdomain-based access
|
- `s3.pathStyle`: For testing - use old path-style URLs, for services that do not support subdomain-based access
|
||||||
|
|
||||||
|
|
|
@ -361,6 +361,12 @@ module.exports = class S3Persistor extends AbstractPersistor {
|
||||||
options.s3ForcePathStyle = true
|
options.s3ForcePathStyle = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (const opt of ['httpOptions', 'maxRetries']) {
|
||||||
|
if (this.settings[opt]) {
|
||||||
|
options[opt] = this.settings[opt]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return options
|
return options
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -265,6 +265,21 @@ describe('S3PersistorTests', function () {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('when given S3 options', function () {
|
||||||
|
const httpOptions = { timeout: 2000 }
|
||||||
|
const maxRetries = 2
|
||||||
|
|
||||||
|
beforeEach(async function () {
|
||||||
|
settings.httpOptions = httpOptions
|
||||||
|
settings.maxRetries = maxRetries
|
||||||
|
await S3Persistor.getObjectStream(bucket, key)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('configures the S3 client appropriately', function () {
|
||||||
|
expect(S3).to.have.been.calledWithMatch({ httpOptions, maxRetries })
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
describe("when the file doesn't exist", function () {
|
describe("when the file doesn't exist", function () {
|
||||||
let error, stream
|
let error, stream
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue