Document the new local config YAML features
Also remove --git-url command line flag (since you can put it in configserver.yml now).
This commit is contained in:
@@ -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).
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -77,7 +77,6 @@ public class LauncherCommand extends OptionParsingCommand {
|
||||
|
||||
private OptionSpec<Void> debugOption;
|
||||
private OptionSpec<Void> listOption;
|
||||
private ArgumentAcceptingOptionSpec<String> 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");
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user