Skip to content

Commit 33f64d9

Browse files
committed
Added ability to get configuration from config end point
1 parent 4d82b3f commit 33f64d9

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

src/configuration/Configuration.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,13 @@ export class Configuration implements IConfigurationSettings {
9494
*/
9595
private _serverUrl: string = 'https://collector.exceptionless.io';
9696

97+
/**
98+
* The config server url that all configuration will be retrieved from.
99+
* @type {string}
100+
* @private
101+
*/
102+
private _configServerUrl: string = 'https://config.exceptionless.io';
103+
97104
/**
98105
* The heartbeat server url that all heartbeats will be sent to.
99106
* @type {string}
@@ -154,6 +161,7 @@ export class Configuration implements IConfigurationSettings {
154161
this.log = inject(configSettings.log) || new NullLog();
155162
this.apiKey = configSettings.apiKey;
156163
this.serverUrl = configSettings.serverUrl;
164+
this.configServerUrl = configSettings.configServerUrl;
157165
this.heartbeatServerUrl = configSettings.heartbeatServerUrl;
158166
this.updateSettingsWhenIdleInterval = configSettings.updateSettingsWhenIdleInterval;
159167
this.includePrivateInformation = configSettings.includePrivateInformation;
@@ -214,12 +222,33 @@ export class Configuration implements IConfigurationSettings {
214222
public set serverUrl(value: string) {
215223
if (!!value) {
216224
this._serverUrl = value;
225+
this._configServerUrl = value;
217226
this._heartbeatServerUrl = value;
218227
this.log.info(`serverUrl: ${value}`);
219228
this.changed();
220229
}
221230
}
222231

232+
/**
233+
* The config server url that all configuration will be retrieved from.
234+
* @returns {string}
235+
*/
236+
public get configServerUrl(): string {
237+
return this._configServerUrl;
238+
}
239+
240+
/**
241+
* The config server url that all configuration will be retrieved from.
242+
* @param value
243+
*/
244+
public set configServerUrl(value: string) {
245+
if (!!value) {
246+
this._configServerUrl = value;
247+
this.log.info(`configServerUrl: ${value}`);
248+
this.changed();
249+
}
250+
}
251+
223252
/**
224253
* The heartbeat server url that all heartbeats will be sent to.
225254
* @returns {string}

src/configuration/IConfigurationSettings.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { ISubmissionClient } from '../submission/ISubmissionClient';
1212
export interface IConfigurationSettings {
1313
apiKey?: string;
1414
serverUrl?: string;
15+
configServerUrl?: string;
1516
heartbeatServerUrl?: string;
1617
updateSettingsWhenIdleInterval?: number;
1718
includePrivateInformation?: boolean;

src/submission/DefaultSubmissionClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export class DefaultSubmissionClient implements ISubmissionClient {
3232
}
3333

3434
public getSettings(config: Configuration, version: number, callback: (response: SettingsResponse) => void): void {
35-
const request = this.createRequest(config, 'GET', `${config.serverUrl}/api/v2/projects/config?v=${version}`);
35+
const request = this.createRequest(config, 'GET', `${config.configServerUrl}/api/v2/projects/config?v=${version}`);
3636
const cb = (status, message, data?, headers?) => {
3737
if (status !== 200) {
3838
return callback(new SettingsResponse(false, null, -1, null, message));

0 commit comments

Comments
 (0)