Ignore empty config paths

This commit is contained in:
Igor Motov 2014-01-20 11:36:37 -05:00
parent 48aaf34f4f
commit 406762f775
1 changed files with 4 additions and 3 deletions

View File

@ -21,6 +21,7 @@ package org.elasticsearch.node.internal;
import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.cluster.ClusterName;
import org.elasticsearch.common.Names; import org.elasticsearch.common.Names;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.collect.Tuple;
import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
@ -57,16 +58,16 @@ public class InternalSettingsPreparer {
boolean loadFromEnv = true; boolean loadFromEnv = true;
if (useSystemProperties) { if (useSystemProperties) {
// if its default, then load it, but also load form env // if its default, then load it, but also load form env
if (System.getProperty("es.default.config") != null) { if (Strings.hasText(System.getProperty("es.default.config"))) {
loadFromEnv = true; loadFromEnv = true;
settingsBuilder.loadFromUrl(environment.resolveConfig(System.getProperty("es.default.config"))); settingsBuilder.loadFromUrl(environment.resolveConfig(System.getProperty("es.default.config")));
} }
// if explicit, just load it and don't load from env // if explicit, just load it and don't load from env
if (System.getProperty("es.config") != null) { if (Strings.hasText(System.getProperty("es.config"))) {
loadFromEnv = false; loadFromEnv = false;
settingsBuilder.loadFromUrl(environment.resolveConfig(System.getProperty("es.config"))); settingsBuilder.loadFromUrl(environment.resolveConfig(System.getProperty("es.config")));
} }
if (System.getProperty("elasticsearch.config") != null) { if (Strings.hasText(System.getProperty("elasticsearch.config"))) {
loadFromEnv = false; loadFromEnv = false;
settingsBuilder.loadFromUrl(environment.resolveConfig(System.getProperty("elasticsearch.config"))); settingsBuilder.loadFromUrl(environment.resolveConfig(System.getProperty("elasticsearch.config")));
} }