public static String lookupEnvironmentVariable(String key) {
        // lookup OS env with upper case key
        String upperKey = key.toUpperCase();
        String value = System.getenv(upperKey);

        if (value == null) {
            // some OS do not support dashes in keys, so replace with underscore
            String normalizedKey = upperKey.replace('-', '_');

            // and replace dots with underscores so keys like my.key are
            // translated to MY_KEY
            normalizedKey = normalizedKey.replace('.', '_');

            value = System.getenv(normalizedKey);
        }
        return value;
    }
@Test
    public void testLookupEnvironmentVariable() {
        assertEquals("8081", IOHelper.lookupEnvironmentVariable("FOO_SERVICE_PORT"));
        assertEquals("8081", IOHelper.lookupEnvironmentVariable("foo-service.port"));
        assertEquals("8081", IOHelper.lookupEnvironmentVariable("foo-service-port"));
        assertEquals("8081", IOHelper.lookupEnvironmentVariable("foo.service.port"));
    }