Only set the custom https agent for HTTPS minio

Otherwise, we get a Cannot set property ‘agent’ of undefined error
This commit is contained in:
Girish Ramakrishnan
2017-10-26 16:20:34 -07:00
parent 6a2b0eedb3
commit d127b25f0f

View File

@@ -108,7 +108,7 @@ function getS3Config(apiConfig, callback) {
if (apiConfig.endpoint) credentials.endpoint = apiConfig.endpoint;
if (apiConfig.acceptSelfSignedCerts === true) {
if (apiConfig.acceptSelfSignedCerts === true && credentials.endpoint && credentials.endpoint.startsWith('https://')) {
credentials.httpOptions.agent = {
agent: new https.Agent({ rejectUnauthorized: false })
};