Skip to content

Commit

Permalink
update env to use IPv6 address (#591)
Browse files Browse the repository at this point in the history
Default host and local-ip to use the IPv6 address rather
than the IPv4 address.
  • Loading branch information
brharrington authored Oct 17, 2023
1 parent 650aa39 commit faed0eb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
8 changes: 3 additions & 5 deletions iep-dynconfig/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,10 @@ netflix.iep.env {
instance-id = ${?TITUS_TASK_INSTANCE_ID}
instance-id = ${?NETFLIX_INSTANCE_ID}

local-ip = "127.0.0.1"
local-ip = ${?EC2_LOCAL_IPV4}
local-ip = "::1"
local-ip = ${?NETFLIX_IPV6}

host = "localhost"
host = ${?EC2_LOCAL_IPV4}
host = ${?EC2_PUBLIC_HOSTNAME}
host = "["${netflix.iep.env.local-ip}"]"

account-id = "unknown"
account-id = ${?EC2_OWNER_ID}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@
*/
package com.netflix.iep.config;

import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.net.Inet6Address;
import java.net.InetAddress;

@RunWith(JUnit4.class)
public class NetflixEnvironmentTest {
Expand All @@ -43,4 +46,12 @@ public void checkMethods() throws Exception {
Thread.currentThread().setContextClassLoader(cl);
}
}

@Test
public void hostAndIPv6() throws Exception {
String host = ConfigManager.get().getString("netflix.iep.env.host");
String ip = host.substring(1, host.length() - 1);
InetAddress addr = InetAddress.getByName(ip);
Assert.assertTrue(addr instanceof Inet6Address);
}
}

0 comments on commit faed0eb

Please sign in to comment.