Remove default URI for git repository

Application will fail fast if the URI is not set. It *is* however
still set to the sample repo in the -exec.jar that we distribute.

Fixes gh-51
This commit is contained in:
Dave Syer
2014-12-18 17:09:11 +00:00
parent b29b492817
commit 6d6ad3dc65
2 changed files with 13 additions and 4 deletions

View File

@@ -42,6 +42,7 @@ import org.eclipse.jgit.transport.OpenSshConfig.Host;
import org.eclipse.jgit.transport.SshSessionFactory;
import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider;
import org.eclipse.jgit.util.FileUtils;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.config.Environment;
import org.springframework.cloud.config.PropertySource;
@@ -57,15 +58,13 @@ import com.jcraft.jsch.Session;
*
*/
@ConfigurationProperties("spring.cloud.config.server.git")
public class JGitEnvironmentRepository implements EnvironmentRepository {
public static final String DEFAULT_URI = "https://github.com/spring-cloud-samples/config-repo";
public class JGitEnvironmentRepository implements EnvironmentRepository, InitializingBean {
private static Log logger = LogFactory.getLog(JGitEnvironmentRepository.class);
private File basedir;
private String uri = DEFAULT_URI;
private String uri;
private ConfigurableEnvironment environment;
@@ -76,6 +75,11 @@ public class JGitEnvironmentRepository implements EnvironmentRepository {
private boolean initialized;
private String[] searchPaths = new String[0];
@Override
public void afterPropertiesSet() throws Exception {
Assert.state(uri!=null, "You need to configure a uri for the git repository");
}
public JGitEnvironmentRepository(ConfigurableEnvironment environment) {
this.environment = environment;

View File

@@ -5,6 +5,11 @@ spring:
name: configserver
jmx:
default_domain: cloud.config.server
cloud:
config:
server:
git:
uri: https://github.com/spring-cloud-samples/config-repo
server:
port: 8888
management: