Treat elasticsearch.ssl.certificateAuthorities as an optional field in Console ES proxy. (#32992)

This commit is contained in:
Aleh Zasypkin 2019-03-12 20:11:22 +02:00 committed by GitHub
parent 1810c68625
commit 1c2481080e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View file

@ -31,7 +31,7 @@ const getDefaultElasticsearchConfig = () => {
return {
hosts: ['http://localhost:9200', 'http://192.168.1.1:1234'],
requestTimeout: moment.duration(30000),
ssl: { certificateAuthorities: [], verificationMode: 'full' },
ssl: { verificationMode: 'full' },
};
};

View file

@ -49,7 +49,8 @@ const createAgent = (legacyConfig) => {
throw new Error(`Unknown ssl verificationMode: ${verificationMode}`);
}
if (legacyConfig.ssl && legacyConfig.ssl.certificateAuthorities.length > 0) {
if (legacyConfig.ssl && Array.isArray(legacyConfig.ssl.certificateAuthorities)
&& legacyConfig.ssl.certificateAuthorities.length > 0) {
agentOptions.ca = legacyConfig.ssl.certificateAuthorities.map(readFile);
}