Rudderstack: Update init logic to automatically use new url when new config is set (#115275)
update rudderstack init logic to rely on existence of old or new sdk config option being set and only defer to feature toggle if both or neither is set
This commit is contained in:
@@ -146,7 +146,19 @@ async function initRudderstackBackend() {
|
||||
return;
|
||||
}
|
||||
|
||||
const modulePromise = config.featureToggles.rudderstackUpgrade
|
||||
// this will need to be updated when rudderstackSdkV3Url is added
|
||||
// Desired logic: if only one of the sdk urls is provided, use respective code
|
||||
// otherwise defer to the feature toggle.
|
||||
const fakeConfigRudderstackSdkV3Url: string | undefined = undefined;
|
||||
|
||||
const hasOldSdkUrl = Boolean(config.rudderstackSdkUrl);
|
||||
const hasNewSdkUrl = Boolean(fakeConfigRudderstackSdkV3Url);
|
||||
const onlyOneConfigURLSet = hasOldSdkUrl !== hasNewSdkUrl;
|
||||
const useNewRudderstack = onlyOneConfigURLSet ? hasNewSdkUrl : config.featureToggles.rudderstackUpgrade;
|
||||
|
||||
const configUrl = useNewRudderstack ? fakeConfigRudderstackSdkV3Url : config.rudderstackSdkUrl;
|
||||
|
||||
const modulePromise = useNewRudderstack
|
||||
? import('./backends/analytics/RudderstackV3Backend')
|
||||
: import('./backends/analytics/RudderstackBackend');
|
||||
|
||||
@@ -157,7 +169,7 @@ async function initRudderstackBackend() {
|
||||
dataPlaneUrl: config.rudderstackDataPlaneUrl,
|
||||
user: contextSrv.user,
|
||||
sdkUrl: config.rudderstackSdkUrl,
|
||||
configUrl: config.rudderstackConfigUrl,
|
||||
configUrl: configUrl,
|
||||
integrationsUrl: config.rudderstackIntegrationsUrl,
|
||||
buildInfo: config.buildInfo,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user