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.
@@ -1200,31 +1200,35 @@
1200
1200
  }
1201
1201
  this.baseUrl = endpoint;
1202
1202
  }
1203
- const api = new BruceApi.Api({
1204
- accountId: this.accountId,
1205
- cam: cam,
1206
- env: this.env,
1207
- // Must be false.
1208
- // Else we get stuck in nested init loop.
1209
- loadConfig: false
1210
- });
1211
- // CDN urls.
1212
- const region = (yield exports.Account.GetDbRegions({
1213
- api,
1214
- key: settings.DBServer
1215
- })).regions[0];
1216
- if (region === null || region === void 0 ? void 0 : region.CDN) {
1217
- this.EntityCdnUrl = (_b = region.CDN.entityURL) === null || _b === void 0 ? void 0 : _b[env];
1218
- // We need to fix our configs.
1219
- if (this.EntityCdnUrl) {
1220
- if (this.EntityCdnUrl.includes("entitiesListForCDN")) {
1221
- this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", this.accountId);
1222
- }
1223
- else {
1224
- this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", "entitiesListForCDN/" + this.accountId);
1203
+ if (settings.DBLocation) {
1204
+ const dbLocation = settings.DBLocation.trim();
1205
+ const api = new BruceApi.Api({
1206
+ accountId: this.accountId,
1207
+ cam: cam,
1208
+ env: this.env,
1209
+ // Must be false.
1210
+ // Else we get stuck in nested init loop.
1211
+ loadConfig: false
1212
+ });
1213
+ // CDN urls.
1214
+ const regions = (yield exports.Account.GetDbRegions({
1215
+ api,
1216
+ key: dbLocation
1217
+ })).regions;
1218
+ const region = regions.find(x => { var _a; return ((_a = x.key) === null || _a === void 0 ? void 0 : _a.trim()) == dbLocation; });
1219
+ if (region === null || region === void 0 ? void 0 : region.CDN) {
1220
+ this.EntityCdnUrl = (_b = region.CDN.entityURL) === null || _b === void 0 ? void 0 : _b[env];
1221
+ // We need to fix our configs.
1222
+ if (this.EntityCdnUrl) {
1223
+ if (this.EntityCdnUrl.includes("entitiesListForCDN")) {
1224
+ this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", this.accountId);
1225
+ }
1226
+ else {
1227
+ this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", "entitiesListForCDN/" + this.accountId);
1228
+ }
1225
1229
  }
1230
+ this.LegacyTilesetCdnUrl = (_c = region.CDN.legacyTilesetURL) === null || _c === void 0 ? void 0 : _c[env];
1226
1231
  }
1227
- this.LegacyTilesetCdnUrl = (_c = region.CDN.legacyTilesetURL) === null || _c === void 0 ? void 0 : _c[env];
1228
1232
  }
1229
1233
  }
1230
1234
  catch (e) {