Default label on client is null (so server can set priority)

Fixes gh-108
This commit is contained in:
Dave Syer
2015-03-20 07:59:49 +00:00
parent d72d4c06a6
commit ea138e8dbd
6 changed files with 52 additions and 16 deletions

View File

@@ -21,6 +21,7 @@ import org.springframework.cloud.config.client.ConfigClientProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.util.StringUtils;
/**
* Bootstrap configuration to fetch external configuration from a (possibly remote)
@@ -45,10 +46,15 @@ public class ConfigServerBootstrapConfiguration {
@Autowired
private ConfigClientProperties client;
@Autowired
private ConfigServerProperties server;
@Bean
public EnvironmentRepositoryPropertySourceLocator environmentRepositoryPropertySourceLocator() {
String label = StringUtils.hasText(client.getLabel()) ? client.getLabel()
: server.getDefaultLabel();
return new EnvironmentRepositoryPropertySourceLocator(repository,
client.getName(), client.getProfile(), client.getLabel());
client.getName(), client.getProfile(), label);
}
}