diff --git a/docs/src/main/asciidoc/intro.adoc b/docs/src/main/asciidoc/intro.adoc index 3a7e4ac..b56c447 100644 --- a/docs/src/main/asciidoc/intro.adoc +++ b/docs/src/main/asciidoc/intro.adoc @@ -4,7 +4,7 @@ Cloud]. You can write Groovy scripts to run Spring Cloud component applications (e.g. `@EnableEurekaServer`). You can also easily do things like encryption and decryption to support Spring Cloud Config clients with secret configuration values. With the Launcher CLI you -can also launch services like Eureka, Zipkin, Config Server +can launch services like Eureka, Zipkin, Config Server conveniently all at once from the command line (very useful at development time). diff --git a/docs/src/main/asciidoc/spring-cloud-cli.adoc b/docs/src/main/asciidoc/spring-cloud-cli.adoc index d7f4f10..032d189 100644 --- a/docs/src/main/asciidoc/spring-cloud-cli.adoc +++ b/docs/src/main/asciidoc/spring-cloud-cli.adoc @@ -51,6 +51,23 @@ Summary of supported deployables: | Zipkin Server with UI for visualizing traces. Stores span data in memory and accepts them via HTTP POST of JSON data. |=== +Each of these apps can be configured using a local YAML file with the same name (in the current +working directory or a subdirectory called "config"). E.g. in `configserver.yml` you might want to +do something like this to locate a local git repository for the backend: + +.configserver.yml +[source,yaml,indent=0] +---- +spring: + profiles: + active: git + cloud: + config: + server: + git: + uri: file://${user.home}/dev/demo/config-repo +---- + == Writing Groovy Scripts and Running Applications Spring Cloud CLI has support for most of the Spring Cloud declarative diff --git a/spring-cloud-launcher/spring-cloud-launcher-cli/src/main/java/org/springframework/cloud/launcher/cli/LauncherCommand.java b/spring-cloud-launcher/spring-cloud-launcher-cli/src/main/java/org/springframework/cloud/launcher/cli/LauncherCommand.java index e3236b8..5b61282 100644 --- a/spring-cloud-launcher/spring-cloud-launcher-cli/src/main/java/org/springframework/cloud/launcher/cli/LauncherCommand.java +++ b/spring-cloud-launcher/spring-cloud-launcher-cli/src/main/java/org/springframework/cloud/launcher/cli/LauncherCommand.java @@ -77,7 +77,6 @@ public class LauncherCommand extends OptionParsingCommand { private OptionSpec debugOption; private OptionSpec listOption; - private ArgumentAcceptingOptionSpec gitUriOption; @Override protected void options() { @@ -85,7 +84,6 @@ public class LauncherCommand extends OptionParsingCommand { // can create options and then populate the args[] that is sent to the DeployerThread this.debugOption = option(Arrays.asList("debug", "d"), "Debug logging for the deployer"); this.listOption = option(Arrays.asList("list", "l"), "List the deployables (don't launch anything)"); - this.gitUriOption = getParser().acceptsAll(Arrays.asList("git-uri", "g"), "URI for git repository for use with configserver").withRequiredArg(); } @Override @@ -126,9 +124,6 @@ public class LauncherCommand extends OptionParsingCommand { if (options.has(this.debugOption)) { args.add("--debug=true"); } - if (options.has(this.gitUriOption)) { - args.add("--git.uri=" + options.valueOf(this.gitUriOption)); - } if (options.has(this.listOption)) { args.add("--launcher.list=true"); } diff --git a/spring-cloud-launcher/spring-cloud-launcher-deployer/src/main/java/org/springframework/cloud/launcher/deployer/DeployerThread.java b/spring-cloud-launcher/spring-cloud-launcher-deployer/src/main/java/org/springframework/cloud/launcher/deployer/DeployerThread.java index 18a3d17..b52dc00 100644 --- a/spring-cloud-launcher/spring-cloud-launcher-deployer/src/main/java/org/springframework/cloud/launcher/deployer/DeployerThread.java +++ b/spring-cloud-launcher/spring-cloud-launcher-deployer/src/main/java/org/springframework/cloud/launcher/deployer/DeployerThread.java @@ -138,15 +138,15 @@ public class DeployerThread extends Thread { PropertySource source = null; Resource resource = new ClassPathResource("config" + path, DeployerThread.class); source = loadPropertySource(resource, path); - if (source==null) { + if (source == null) { resource = new ClassPathResource(path, DeployerThread.class); source = loadPropertySource(resource, path); } - if (source==null) { + if (source == null) { resource = new FileSystemResource("config" + path); source = loadPropertySource(resource, path); } - if (source==null) { + if (source == null) { resource = new FileSystemResource("." + path); source = loadPropertySource(resource, path); } @@ -156,8 +156,9 @@ public class DeployerThread extends Thread { private PropertySource loadPropertySource(Resource resource, String path) { if (resource.exists()) { try { - PropertySource source = new YamlPropertySourceLoader().load(path, resource, null); - if (source!=null) { + PropertySource source = new YamlPropertySourceLoader().load(path, + resource, null); + if (source != null) { logger.info("Loaded YAML properties from: " + resource); } return source; @@ -261,12 +262,6 @@ public class DeployerThread extends Thread { for (String key : map.keySet()) { appDefProps.put(key, map.get(key)); } - if (deployable.getName().equals("configserver") - && environment.containsProperty("git.uri")) { - appDefProps.put("spring.profiles.active", "git"); - appDefProps.put("spring.cloud.config.server.git.uri", - environment.getRequiredProperty("git.uri")); - } AppDefinition definition = new AppDefinition(deployable.getName(), appDefProps);