bruce-models 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1218,31 +1218,35 @@ var BruceApi;
1218
1218
  }
1219
1219
  this.baseUrl = endpoint;
1220
1220
  }
1221
- const api = new BruceApi.Api({
1222
- accountId: this.accountId,
1223
- cam: cam,
1224
- env: this.env,
1225
- // Must be false.
1226
- // Else we get stuck in nested init loop.
1227
- loadConfig: false
1228
- });
1229
- // CDN urls.
1230
- const region = (yield Account.GetDbRegions({
1231
- api,
1232
- key: settings.DBServer
1233
- })).regions[0];
1234
- if (region === null || region === void 0 ? void 0 : region.CDN) {
1235
- this.EntityCdnUrl = (_b = region.CDN.entityURL) === null || _b === void 0 ? void 0 : _b[env];
1236
- // We need to fix our configs.
1237
- if (this.EntityCdnUrl) {
1238
- if (this.EntityCdnUrl.includes("entitiesListForCDN")) {
1239
- this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", this.accountId);
1240
- }
1241
- else {
1242
- this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", "entitiesListForCDN/" + this.accountId);
1221
+ if (settings.DBLocation) {
1222
+ const dbLocation = settings.DBLocation.trim();
1223
+ const api = new BruceApi.Api({
1224
+ accountId: this.accountId,
1225
+ cam: cam,
1226
+ env: this.env,
1227
+ // Must be false.
1228
+ // Else we get stuck in nested init loop.
1229
+ loadConfig: false
1230
+ });
1231
+ // CDN urls.
1232
+ const regions = (yield Account.GetDbRegions({
1233
+ api,
1234
+ key: dbLocation
1235
+ })).regions;
1236
+ const region = regions.find(x => { var _a; return ((_a = x.key) === null || _a === void 0 ? void 0 : _a.trim()) == dbLocation; });
1237
+ if (region === null || region === void 0 ? void 0 : region.CDN) {
1238
+ this.EntityCdnUrl = (_b = region.CDN.entityURL) === null || _b === void 0 ? void 0 : _b[env];
1239
+ // We need to fix our configs.
1240
+ if (this.EntityCdnUrl) {
1241
+ if (this.EntityCdnUrl.includes("entitiesListForCDN")) {
1242
+ this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", this.accountId);
1243
+ }
1244
+ else {
1245
+ this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", "entitiesListForCDN/" + this.accountId);
1246
+ }
1243
1247
  }
1248
+ this.LegacyTilesetCdnUrl = (_c = region.CDN.legacyTilesetURL) === null || _c === void 0 ? void 0 : _c[env];
1244
1249
  }
1245
- this.LegacyTilesetCdnUrl = (_c = region.CDN.legacyTilesetURL) === null || _c === void 0 ? void 0 : _c[env];
1246
1250
  }
1247
1251
  }
1248
1252
  catch (e) {