Support .yaml extension for FILES format.

This commit is contained in:
Spencer Gibb
2016-03-11 16:16:40 -07:00
parent 373072182a
commit c6e7db055e
3 changed files with 3 additions and 2 deletions

View File

@@ -36,7 +36,7 @@ public class ConsulFilesPropertySource extends ConsulPropertySource {
}
public void init(GetValue value) {
if (this.getContext().endsWith(".yml")) {
if (this.getContext().endsWith(".yml") || this.getContext().endsWith(".yaml")) {
parseValue(value, YAML);
} else if (this.getContext().endsWith(".properties")) {
parseValue(value, PROPERTIES);

View File

@@ -75,6 +75,7 @@ public class ConsulPropertySourceLocator implements PropertySourceLocator {
suffixes.add("/");
} else {
suffixes.add(".yml");
suffixes.add(".yaml");
suffixes.add(".properties");
}

View File

@@ -53,7 +53,7 @@ public class ConsulPropertySourceLocatorFilesTests {
public static final String ROOT = PREFIX + UUID.randomUUID();
public static final String APP_NAME = "testFilesFormat";
public static final String APPLICATION_YML = "/application.yml";
public static final String APPLICATION_DEV_YML = "/application-dev.yml";
public static final String APPLICATION_DEV_YML = "/application-dev.yaml";
public static final String APP_NAME_PROPS = "/"+APP_NAME+".properties";
public static final String APP_NAME_DEV_PROPS = "/"+APP_NAME+"-dev.properties";