diff --git a/app/utils/base_client.js b/app/utils/base_client.js index 74923bb57..1a50217a7 100644 --- a/app/utils/base_client.js +++ b/app/utils/base_client.js @@ -15,7 +15,6 @@ const {getNamespace} = require('continuation-local-storage') const AWSXRay = require('aws-xray-sdk') // Local dependencies -const customCertificate = require('./custom_certificate') const CORRELATION_HEADER_NAME = require('./correlation_header').CORRELATION_HEADER const {addProxy} = require('./add_proxy') @@ -26,12 +25,6 @@ const agentOptions = { const clsXrayConfig = require('../../config/xray-cls') -if (process.env.DISABLE_INTERNAL_HTTPS !== 'true') { - agentOptions.ca = customCertificate.getCertOptions() -} else { - logger.warn('DISABLE_INTERNAL_HTTPS is set.') -} - /** * @type {http.Agent} */ diff --git a/app/utils/custom_certificate.js b/app/utils/custom_certificate.js deleted file mode 100644 index f66b84c76..000000000 --- a/app/utils/custom_certificate.js +++ /dev/null @@ -1,32 +0,0 @@ -'use strict' -// core dependencies -const path = require('path') -const fs = require('fs') - -// npm dependencies -const logger = require('winston') - -// constants -const CERTS_PATH = process.env.CERTS_PATH || path.join(__dirname, '/../../certs') -exports.getCertOptions = (certsPath) => { - certsPath = certsPath || CERTS_PATH - try { - if (fs.lstatSync(certsPath).isDirectory()) { - // Read everything from the certificates directories - // Get everything that isn't a directory (e.g. files, symlinks) - // Read it (assume it is a certificate) - // Add it to the agentOptions list of CAs - const ca = [] - fs.readdirSync(certsPath) - .map(certPath => path.join(certsPath, certPath)) - .filter(fullCertPath => !fs.lstatSync(fullCertPath).isDirectory()) - .map(fullCertPath => fs.readFileSync(fullCertPath)) - .forEach(caCont => ca.push(caCont)) - return ca - } else { - logger.error('Provided CERTS_PATH is not a directory', {certsPath}) - } - } catch (e) { - logger.error('Provided CERTS_PATH could not be read', {certsPath}) - } -} diff --git a/env.sh b/env.sh index 9240cc0d4..5c7ce2707 100755 --- a/env.sh +++ b/env.sh @@ -4,9 +4,7 @@ if [ -f $ENV_FILE ] then set -a source $ENV_FILE - set +a + set +a fi -export CERTS_PATH=$WORKSPACE/pay-scripts/services/ssl/certs - eval "$@" diff --git a/test/unit/custom_certificate_tests.js b/test/unit/custom_certificate_tests.js deleted file mode 100644 index 56c811f65..000000000 --- a/test/unit/custom_certificate_tests.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict' - -// core dependencies -const path = require('path') - -// npm dependencies -const {expect} = require('chai') -const customCertificate = require('../../app/utils/custom_certificate.js') - -// constants -const CERTS_PATH = path.join(__dirname, '/../test_helpers/certs') - -describe('custom certificate', () => { - it('should set secure options', () => { - const ca = customCertificate.getCertOptions(CERTS_PATH) - expect(ca.length).to.equal(1) - }) -})