diff --git a/app/lib/index.js b/app/lib/index.js index bc045574ca..4dbd0a1109 100644 --- a/app/lib/index.js +++ b/app/lib/index.js @@ -690,7 +690,8 @@ function bootstrap() { errorTracking.setTag(Sentry, 'plugins', generatePluginsTag(plugins)); // (9) zeebe API - const zeebeAPI = new ZeebeAPI({ readFile }, ZeebeNode, flags); + const zeebeCustomCertificatePath = flags.get('zeebe-ssl-certificate'); + const zeebeAPI = new ZeebeAPI({ readFile }, ZeebeNode, zeebeCustomCertificatePath); // (10) connector templates if (flags.get('enable-connector-templates', false)) { diff --git a/app/lib/zeebe-api/zeebe-api.js b/app/lib/zeebe-api/zeebe-api.js index 67b11ba15b..b7ba116ee5 100644 --- a/app/lib/zeebe-api/zeebe-api.js +++ b/app/lib/zeebe-api/zeebe-api.js @@ -110,11 +110,11 @@ const CLIENT_OPTIONS_SECRETS = [ */ class ZeebeAPI { - constructor(fs, ZeebeNode, flags, log = createLog('app:zeebe-api')) { + constructor(fs, ZeebeNode, customCertificatePath, log = createLog('app:zeebe-api')) { this._fs = fs; this._ZeebeNode = ZeebeNode; - this._flags = flags; + this._customCertificatePath = customCertificatePath; this._log = log; this._zeebeClient = null; @@ -400,8 +400,8 @@ class ZeebeAPI { useTLS: options.useTLS || /^https:\/\//.test(url) }; - // (1) use certificate from flag - const customCertificatePath = this._flags.get('zeebe-ssl-certificate'); + // (1) use certificate from custom path + const customCertificatePath = this._customCertificatePath; if (customCertificatePath) { const cert = this._readRootCertificate(customCertificatePath); diff --git a/app/test/spec/zeebe-api/zeebe-api-spec.js b/app/test/spec/zeebe-api/zeebe-api-spec.js index 41ac0153d3..074c3c9211 100644 --- a/app/test/spec/zeebe-api/zeebe-api-spec.js +++ b/app/test/spec/zeebe-api/zeebe-api-spec.js @@ -2148,11 +2148,7 @@ describe('ZeebeAPI', function() { deployResource: noop }; }, - flags: { - get() { - return '/path/to/cert.pem'; - } - }, + customCertificatePath: '/path/to/cert.pem', fs: { readFile() { return { contents: certificate }; @@ -2173,7 +2169,7 @@ describe('ZeebeAPI', function() { } - it('should pass root certificate from flag', async () => { + it('should pass root certificate', async () => { // given const cert = readFile('./root-self-signed.pem'); @@ -2531,9 +2527,7 @@ function mockZeebeNode(options = {}) { const fs = options.fs || { readFile: () => ({}) }; - const flags = options.flags || { - get: () => {} - }; + const customCertificatePath = options.customCertificatePath; const log = { error() {}, debug() {}, @@ -2553,7 +2547,7 @@ function mockZeebeNode(options = {}) { } }; - return new ZeebeAPI(fs, ZeebeNode, flags, log); + return new ZeebeAPI(fs, ZeebeNode, customCertificatePath, log); } function noop() {}