Skip to content

Commit faed0eb

Browse files
authored
update env to use IPv6 address (#591)
Default host and local-ip to use the IPv6 address rather than the IPv4 address.
1 parent 650aa39 commit faed0eb

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

iep-dynconfig/src/main/resources/reference.conf

+3-5
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,10 @@ netflix.iep.env {
2929
instance-id = ${?TITUS_TASK_INSTANCE_ID}
3030
instance-id = ${?NETFLIX_INSTANCE_ID}
3131

32-
local-ip = "127.0.0.1"
33-
local-ip = ${?EC2_LOCAL_IPV4}
32+
local-ip = "::1"
33+
local-ip = ${?NETFLIX_IPV6}
3434

35-
host = "localhost"
36-
host = ${?EC2_LOCAL_IPV4}
37-
host = ${?EC2_PUBLIC_HOSTNAME}
35+
host = "["${netflix.iep.env.local-ip}"]"
3836

3937
account-id = "unknown"
4038
account-id = ${?EC2_OWNER_ID}

iep-dynconfig/src/test/java/com/netflix/iep/config/NetflixEnvironmentTest.java

+11
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@
1515
*/
1616
package com.netflix.iep.config;
1717

18+
import org.junit.Assert;
1819
import org.junit.Test;
1920
import org.junit.runner.RunWith;
2021
import org.junit.runners.JUnit4;
2122

2223
import java.lang.reflect.Method;
2324
import java.lang.reflect.Modifier;
25+
import java.net.Inet6Address;
26+
import java.net.InetAddress;
2427

2528
@RunWith(JUnit4.class)
2629
public class NetflixEnvironmentTest {
@@ -43,4 +46,12 @@ public void checkMethods() throws Exception {
4346
Thread.currentThread().setContextClassLoader(cl);
4447
}
4548
}
49+
50+
@Test
51+
public void hostAndIPv6() throws Exception {
52+
String host = ConfigManager.get().getString("netflix.iep.env.host");
53+
String ip = host.substring(1, host.length() - 1);
54+
InetAddress addr = InetAddress.getByName(ip);
55+
Assert.assertTrue(addr instanceof Inet6Address);
56+
}
4657
}

0 commit comments

Comments
 (0)