Skip to content

Commit

Permalink
added support for configurable config url
Browse files Browse the repository at this point in the history
  • Loading branch information
prabrisha-rudder committed Feb 18, 2020
1 parent 296c9a7 commit 92f6dda
Show file tree
Hide file tree
Showing 2 changed files with 197 additions and 173 deletions.
6 changes: 5 additions & 1 deletion analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ class Analytics {
* @memberof Analytics
*/
load(writeKey, serverUrl, options) {
let configUrl = CONFIG_URL;
if (!writeKey || !serverUrl || serverUrl.length == 0) {
handleError({
message: "Unable to load due to wrong writeKey or serverUrl"
Expand All @@ -583,6 +584,9 @@ class Analytics {
if (options && options.logLevel) {
logger.setLogLevel(options.logLevel);
}
if (options && options.configUrl) {
configUrl = options.configUrl;
}
if (
options &&
options.valTrackingList &&
Expand All @@ -596,7 +600,7 @@ class Analytics {
this.eventRepository.url = serverUrl;
}
try {
getJSONTrimmed(this, CONFIG_URL, writeKey, this.processResponse);
getJSONTrimmed(this, configUrl, writeKey, this.processResponse);
} catch (error) {
handleError(error);
if (this.autoTrackFeatureEnabled && !this.autoTrackHandlersRegistered) {
Expand Down
Loading

0 comments on commit 92f6dda

Please sign in to comment.