From c6e7db055e3c950e1f0ab5f55c88102b7747a759 Mon Sep 17 00:00:00 2001 From: Spencer Gibb Date: Fri, 11 Mar 2016 16:16:40 -0700 Subject: [PATCH] Support .yaml extension for FILES format. --- .../cloud/consul/config/ConsulFilesPropertySource.java | 2 +- .../cloud/consul/config/ConsulPropertySourceLocator.java | 1 + .../consul/config/ConsulPropertySourceLocatorFilesTests.java | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/spring-cloud-consul-config/src/main/java/org/springframework/cloud/consul/config/ConsulFilesPropertySource.java b/spring-cloud-consul-config/src/main/java/org/springframework/cloud/consul/config/ConsulFilesPropertySource.java index 8da169e5..57593091 100644 --- a/spring-cloud-consul-config/src/main/java/org/springframework/cloud/consul/config/ConsulFilesPropertySource.java +++ b/spring-cloud-consul-config/src/main/java/org/springframework/cloud/consul/config/ConsulFilesPropertySource.java @@ -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); diff --git a/spring-cloud-consul-config/src/main/java/org/springframework/cloud/consul/config/ConsulPropertySourceLocator.java b/spring-cloud-consul-config/src/main/java/org/springframework/cloud/consul/config/ConsulPropertySourceLocator.java index 22333ca3..c1ce00b9 100644 --- a/spring-cloud-consul-config/src/main/java/org/springframework/cloud/consul/config/ConsulPropertySourceLocator.java +++ b/spring-cloud-consul-config/src/main/java/org/springframework/cloud/consul/config/ConsulPropertySourceLocator.java @@ -75,6 +75,7 @@ public class ConsulPropertySourceLocator implements PropertySourceLocator { suffixes.add("/"); } else { suffixes.add(".yml"); + suffixes.add(".yaml"); suffixes.add(".properties"); } diff --git a/spring-cloud-consul-config/src/test/java/org/springframework/cloud/consul/config/ConsulPropertySourceLocatorFilesTests.java b/spring-cloud-consul-config/src/test/java/org/springframework/cloud/consul/config/ConsulPropertySourceLocatorFilesTests.java index 546ac62f..02de441b 100644 --- a/spring-cloud-consul-config/src/test/java/org/springframework/cloud/consul/config/ConsulPropertySourceLocatorFilesTests.java +++ b/spring-cloud-consul-config/src/test/java/org/springframework/cloud/consul/config/ConsulPropertySourceLocatorFilesTests.java @@ -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";