2019-12-16 11:20:29 +00:00
|
|
|
const chai = require('chai')
|
|
|
|
const { expect } = chai
|
2020-02-28 15:27:29 +00:00
|
|
|
const SandboxedModule = require('sandboxed-module')
|
2018-07-06 10:05:40 +00:00
|
|
|
|
2020-08-10 16:01:12 +00:00
|
|
|
describe('Settings', function () {
|
|
|
|
describe('s3', function () {
|
|
|
|
it('should use JSONified env var if present', function () {
|
2020-01-07 09:46:53 +00:00
|
|
|
const s3Settings = {
|
2019-12-16 11:20:22 +00:00
|
|
|
bucket1: {
|
2019-12-16 11:20:29 +00:00
|
|
|
auth_key: 'bucket1_key',
|
|
|
|
auth_secret: 'bucket1_secret'
|
2019-12-16 11:20:22 +00:00
|
|
|
}
|
2019-12-16 11:20:29 +00:00
|
|
|
}
|
2020-01-07 09:46:53 +00:00
|
|
|
process.env.S3_BUCKET_CREDENTIALS = JSON.stringify(s3Settings)
|
2020-02-28 15:27:29 +00:00
|
|
|
const settings = SandboxedModule.require('settings-sharelatex', {
|
2020-03-04 10:08:31 +00:00
|
|
|
globals: { console, process }
|
2020-02-28 15:27:29 +00:00
|
|
|
})
|
2020-07-08 09:14:02 +00:00
|
|
|
expect(settings.filestore.s3.bucketCreds).to.deep.equal(s3Settings)
|
2020-01-07 09:46:53 +00:00
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|