Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bootstrapper config rename #107

Merged
merged 1 commit into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/context/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 ) {
Expand Down
4 changes: 2 additions & 2 deletions src/context/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ const defaultOptions = {
apiSessionHeartbeatTimeMax: (5),

/**
* See {@link Options.httpAgentTargetService}
* See {@link Options.bootstrapperTargetService}
*
*/
httpAgentTargetService: 'unknown',
bootstrapperTargetService: 'unknown',

};

Expand Down
2 changes: 1 addition & 1 deletion src/http/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/http/ziti-websocket-wrapper-ctor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
16 changes: 8 additions & 8 deletions src/http/ziti-websocket-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand All @@ -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;
}

Expand Down Expand Up @@ -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
Expand Down
Loading