Skip to content
This repository was archived by the owner on Mar 31, 2024. It is now read-only.

Commit

Permalink
[ssl.ca] always treat ssl.ca as an array, Joi will convert if it is not
Browse files Browse the repository at this point in the history
(cherry picked from commit 2a236bd4821a7030f2a6624a86633f935952173c)
  • Loading branch information
spalger committed Mar 11, 2016
1 parent a41619d commit 65a0579
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions server/__tests__/proxy_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ describe('ProxyConfig', function () {
it('uses ca to create sslAgent', function () {
const config = new ProxyConfig({
ssl: {
ca: 'path/to/ca'
ca: ['path/to/ca']
}
});

expect(config.sslAgent).to.be.a(https.Agent);
sinon.assert.calledOnce(https.Agent);
const sslAgentOpts = https.Agent.firstCall.args[0];
expect(sslAgentOpts).to.eql({
ca: { path: 'path/to/ca' },
ca: [{ path: 'path/to/ca' }],
cert: undefined,
key: undefined,
});
Expand All @@ -74,7 +74,7 @@ describe('ProxyConfig', function () {
it('uses ca, cert, and key to create sslAgent', function () {
const config = new ProxyConfig({
ssl: {
ca: 'path/to/ca',
ca: ['path/to/ca'],
cert: 'path/to/cert',
key: 'path/to/key'
}
Expand All @@ -84,7 +84,7 @@ describe('ProxyConfig', function () {
sinon.assert.calledOnce(https.Agent);
const sslAgentOpts = https.Agent.firstCall.args[0];
expect(sslAgentOpts).to.eql({
ca: { path: 'path/to/ca' },
ca: [{ path: 'path/to/ca' }],
cert: { path: 'path/to/cert' },
key: { path: 'path/to/key' },
});
Expand Down Expand Up @@ -131,7 +131,7 @@ describe('ProxyConfig', function () {
it('creates but does not output the agent', function () {
const config = new ProxyConfig({
ssl: {
ca: 'path/to/ca'
ca: ['path/to/ca']
}
});

Expand Down Expand Up @@ -183,7 +183,7 @@ describe('ProxyConfig', function () {
it('creates and outputs the agent', function () {
const config = new ProxyConfig({
ssl: {
ca: 'path/to/ca'
ca: ['path/to/ca']
}
});

Expand Down
2 changes: 1 addition & 1 deletion server/__tests__/proxy_config_collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ describe('ProxyConfigCollection', function () {
return new ProxyConfigCollection([
{
match: { host: '*.internal.org' },
ssl: { ca: 'path/to/ca' }
ssl: { ca: ['path/to/ca'] }
},
{
match: { host: '*' },
Expand Down
2 changes: 1 addition & 1 deletion server/proxy_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class ProxyConfig {
this.verifySsl = ssl.verify;

const sslAgentOpts = {
ca: ssl.ca && readFileSync(ssl.ca),
ca: ssl.ca && ssl.ca.map(ca => readFileSync(ca)),
cert: ssl.cert && readFileSync(ssl.cert),
key: ssl.key && readFileSync(ssl.key),
};
Expand Down

0 comments on commit 65a0579

Please sign in to comment.