(serviceName?: string)
| 375 | } |
| 376 | |
| 377 | getBaseUrl(serviceName?: string) { |
| 378 | if (!serviceName) serviceName = 'api'; |
| 379 | |
| 380 | if (this.options.urlOverride && this.options.urlOverride[serviceName]) return this.options.urlOverride[serviceName]; |
| 381 | |
| 382 | const urlEnvironmentKey = serviceName === 'api' ? 'STREAM_BASE_URL' : `STREAM_${serviceName.toUpperCase()}_URL`; |
| 383 | if (typeof process !== 'undefined' && process.env?.[urlEnvironmentKey]) |
| 384 | return process.env[urlEnvironmentKey] as string; |
| 385 | |
| 386 | if ((typeof process !== 'undefined' && process.env?.LOCAL) || this.options.local) |
| 387 | return `http://localhost:8000/${serviceName}/`; |
| 388 | |
| 389 | if (this.location) { |
| 390 | const protocol = this.options.protocol || 'https'; |
| 391 | return `${protocol}://${this.location}-${serviceName}.stream-io-api.com/${serviceName}/`; |
| 392 | } |
| 393 | |
| 394 | if (serviceName !== 'api') return `https://${serviceName}.stream-io-api.com/${serviceName}/`; |
| 395 | |
| 396 | return this.baseUrl; |
| 397 | } |
| 398 | |
| 399 | /** |
| 400 | * Support for global event callbacks |
no outgoing calls
no test coverage detected