@@ -9,26 +9,30 @@ internal class ConnectionStringFactory
9
9
{
10
10
public static string GetReplicationSource_1_7 ( string userName = null )
11
11
{
12
- return GetReplicationSource ( userName , " localhost:3301", "TARANTOOL_1_7_REPLICATION_SOURCE" ) ;
12
+ return GetReplicationSource ( userName , $ " { ResolveHostname ( " localhost" ) } :3301", "TARANTOOL_1_7_REPLICATION_SOURCE" ) ;
13
13
}
14
14
15
15
public static string GetReplicationSource_1_8 ( string userName = null )
16
16
{
17
- return GetReplicationSource ( userName , " localhost:3302", "TARANTOOL_1_8_REPLICATION_SOURCE" ) ;
17
+ return GetReplicationSource ( userName , $ " { ResolveHostname ( " localhost" ) } :3302", "TARANTOOL_1_8_REPLICATION_SOURCE" ) ;
18
18
}
19
19
20
20
public static async Task < string > GetRedisConnectionString ( )
21
21
{
22
22
var redisUrl = Environment . GetEnvironmentVariable ( "REDIS_HOST" ) ;
23
23
24
- var host = "127.0.0.1" ;
25
- if ( ! string . IsNullOrWhiteSpace ( redisUrl ) )
24
+ return $ "{ await ResolveHostname ( redisUrl ) } :6379";
25
+ }
26
+
27
+ private static async Task < string > ResolveHostname ( string host )
28
+ {
29
+ if ( ! string . IsNullOrWhiteSpace ( host ) )
26
30
{
27
- var resolved = await Dns . GetHostAddressesAsync ( redisUrl ) ;
28
- host = resolved . First ( ) . ToString ( ) ;
31
+ var resolved = await Dns . GetHostAddressesAsync ( host ) ;
32
+ return resolved . First ( ) . ToString ( ) ;
29
33
}
30
34
31
- return $ " { host } :6379 ";
35
+ return "127.0.0.1 ";
32
36
}
33
37
34
38
private static string GetReplicationSource ( string userName , string defaultString , string envName )
0 commit comments