@@ -2,25 +2,27 @@ import { IP_ADDRESS_REGEX, PRIVATE_IP_ADDRESS_REGEX } from 'src/constants';
2
2
import { HostingProvider } from 'src/modules/database/entities/database.entity' ;
3
3
import { RedisClient } from 'src/modules/redis/client' ;
4
4
5
- // Ignore LGTM [js/incomplete-url-substring-sanitization] alert.
6
5
// Because we do not bind potentially dangerous logic to this.
7
6
// We define a hosting provider for telemetry only.
8
7
export const getHostingProvider = async ( client : RedisClient , databaseHost : string ) : Promise < HostingProvider > => {
9
8
try {
10
9
const host = databaseHost . toLowerCase ( ) ;
11
10
12
11
// Tries to detect the hosting provider from the hostname.
13
- if ( host . endsWith ( 'rlrcp.com' ) || host . endsWith ( 'redislabs.com' ) ) { // lgtm[js/incomplete-url-substring-sanitization]
12
+ if ( host . endsWith ( 'rlrcp.com' ) || host . endsWith ( 'redislabs.com' ) || host . endsWith ( 'redis-cloud.com' ) ) {
14
13
return HostingProvider . RE_CLOUD ;
15
14
}
16
- if ( host . endsWith ( 'cache.amazonaws.com' ) ) { // lgtm[js/incomplete-url-substring-sanitization]
15
+ if ( host . endsWith ( 'cache.amazonaws.com' ) ) {
17
16
return HostingProvider . AWS_ELASTICACHE ;
18
17
}
19
18
if ( host . includes ( 'memorydb' ) ) {
20
19
return HostingProvider . AWS_MEMORYDB ;
21
20
}
22
- if ( host . endsWith ( 'cache.windows.net' ) ) { // lgtm[js/incomplete-url-substring-sanitization]
23
- return HostingProvider . AZURE ;
21
+ if ( host . endsWith ( 'cache.windows.net' ) ) {
22
+ return HostingProvider . AZURE_CACHE ;
23
+ }
24
+ if ( host . endsWith ( 'redisenterprise.cache.azure.net' ) ) {
25
+ return HostingProvider . AZURE_CACHE_REDIS_ENTERPRISE ;
24
26
}
25
27
26
28
try {
0 commit comments