From b9a9a2f63fc9f1e32de3055d2197e63f39bc26e6 Mon Sep 17 00:00:00 2001 From: Curt Tudor Date: Wed, 26 Jul 2023 15:03:58 -0600 Subject: [PATCH] bootstrapper config rename --- src/context/context.js | 4 ++-- src/context/options.js | 4 ++-- src/http/request.js | 2 +- src/http/ziti-websocket-wrapper-ctor.js | 6 +++--- src/http/ziti-websocket-wrapper.js | 16 ++++++++-------- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/context/context.js b/src/context/context.js index e505d8e..b1eb817 100644 --- a/src/context/context.js +++ b/src/context/context.js @@ -89,7 +89,7 @@ class ZitiContext extends EventEmitter { this.apiSessionHeartbeatTimeMin = _options.apiSessionHeartbeatTimeMin; this.apiSessionHeartbeatTimeMax = _options.apiSessionHeartbeatTimeMax; - this.httpAgentTargetService = _options.httpAgentTargetService; + this.bootstrapperTargetService = _options.bootstrapperTargetService; this._libCrypto = new LibCrypto(); this._libCryptoInitialized = false; @@ -1785,7 +1785,7 @@ class ZitiContext extends EventEmitter { } } - let corsHostsArray = window.zitiBrowzerRuntime.zitiConfig.httpAgent.corsProxy.hosts.split(','); + let corsHostsArray = window.zitiBrowzerRuntime.zitiConfig.browzer.bootstrapper.corsProxy.hosts.split(','); let routeOverCORSProxy = false; forEach(corsHostsArray, function( corsHost ) { diff --git a/src/context/options.js b/src/context/options.js index ec0bb7a..05e3226 100644 --- a/src/context/options.js +++ b/src/context/options.js @@ -85,10 +85,10 @@ const defaultOptions = { apiSessionHeartbeatTimeMax: (5), /** - * See {@link Options.httpAgentTargetService} + * See {@link Options.bootstrapperTargetService} * */ - httpAgentTargetService: 'unknown', + bootstrapperTargetService: 'unknown', }; diff --git a/src/http/request.js b/src/http/request.js index 24e1fe7..56b3424 100644 --- a/src/http/request.js +++ b/src/http/request.js @@ -200,7 +200,7 @@ ZitiHttpRequest.prototype.getServiceConnectAppData = function() { const headers = this[INTERNALS].headers; // Transform all occurances of the HTTP Agent hostname back to the target service name - var replace = this.getZitiContext().httpAgentTargetService; + var replace = this.getZitiContext().bootstrapperTargetService; var re = new RegExp(replace,"i"); parsedURL.href = parsedURL.href.replace(re, replace); parsedURL.search = parsedURL.search.replace(re, replace); diff --git a/src/http/ziti-websocket-wrapper-ctor.js b/src/http/ziti-websocket-wrapper-ctor.js index fbd4fd0..1be2bd3 100644 --- a/src/http/ziti-websocket-wrapper-ctor.js +++ b/src/http/ziti-websocket-wrapper-ctor.js @@ -30,10 +30,10 @@ class ZitiWebSocketWrapperCtor { // It is assumed that the ziti-browzer-runtime has already initialized before we get here - // We only want to intercept WebSockets that target the Ziti HTTP Agent - var regex = new RegExp( zitiBrowzerRuntime.zitiConfig.httpAgent.self.host, 'g' ); + // We only want to intercept WebSockets that target the Ziti BrowZer Bootstrapper + var regex = new RegExp( zitiBrowzerRuntime.zitiConfig.browzer.bootstrapper.self.host, 'g' ); - if (address.match( regex )) { // the request is targeting the Ziti HTTP Agent + if (address.match( regex )) { // the request is targeting the Ziti BrowZer Bootstrapper let ws = new ZitiWebSocketWrapper(address, protocols, options, zitiBrowzerRuntime.zitiContext, zitiBrowzerRuntime.zitiConfig); diff --git a/src/http/ziti-websocket-wrapper.js b/src/http/ziti-websocket-wrapper.js index c50a313..57ab83f 100644 --- a/src/http/ziti-websocket-wrapper.js +++ b/src/http/ziti-websocket-wrapper.js @@ -538,14 +538,14 @@ async function initAsClient(websocket, address, protocols, options) { // await loadCookies(parsedUrl.hostname); - // We only want to intercept fetch requests that target the Ziti HTTP Agent - var regex = new RegExp( websocket._zitiConfig.httpAgent.self.host, 'g' ); + // We only want to intercept fetch requests that target the Ziti BrowZer Bootstrapper + var regex = new RegExp( websocket._zitiConfig.browzer.bootstrapper.self.host, 'g' ); - if (address.match( regex )) { // the request is targeting the Ziti HTTP Agent + if (address.match( regex )) { // the request is targeting the Ziti BrowZer Bootstrapper var newUrl = new URL( address ); - newUrl.hostname = websocket._zitiConfig.httpAgent.target.service; - newUrl.port = websocket._zitiConfig.httpAgent.target.port; + newUrl.hostname = websocket._zitiConfig.browzer.bootstrapper.target.service; + newUrl.port = websocket._zitiConfig.browzer.bootstrapper.target.port; websocket._zitiContext.logger.debug( 'ZitiWebSocketWrapper: transformed URL: ', newUrl.toString()); serviceName = await websocket._zitiContext.shouldRouteOverZiti( newUrl ); @@ -562,9 +562,9 @@ async function initAsClient(websocket, address, protocols, options) { let configHostAndPort = await websocket._zitiContext.getConfigHostAndPortByServiceName (serviceName); - newUrl.protocol = websocket._zitiConfig.httpAgent.target.scheme + ":"; + newUrl.protocol = websocket._zitiConfig.browzer.bootstrapper.target.scheme + ":"; opts.href = newUrl.protocol + '//' + configHostAndPort.host.toLowerCase() + newUrl.pathname + newUrl.search; - opts.origin = websocket._zitiConfig.httpAgent.target.scheme + "://" + configHostAndPort.host.toLowerCase(); // + ":" + configHostAndPort.port; + opts.origin = websocket._zitiConfig.browzer.bootstrapper.target.scheme + "://" + configHostAndPort.host.toLowerCase(); // + ":" + configHostAndPort.port; opts.host = serviceName; } @@ -642,7 +642,7 @@ async function initAsClient(websocket, address, protocols, options) { } opts.serviceName = serviceName; - opts.serviceScheme = websocket._zitiConfig.httpAgent.target.scheme; + opts.serviceScheme = websocket._zitiConfig.browzer.bootstrapper.target.scheme; opts.serviceConnectAppData = await websocket._zitiContext.getConnectAppDataByServiceName(serviceName); // build HTTP request object