summaryrefslogtreecommitdiff
path: root/core/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java')
-rw-r--r--core/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java27
1 files changed, 7 insertions, 20 deletions
diff --git a/core/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java b/core/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java
index 6d35cafd08..305a4fd30a 100644
--- a/core/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java
+++ b/core/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java
@@ -177,15 +177,7 @@ final class Bootstrap {
// install SM after natives, shutdown hooks, etc.
Security.configure(environment, BootstrapSettings.SECURITY_FILTER_BAD_DEFAULTS_SETTING.get(settings));
- // We do not need to reload system properties here as we have already applied them in building the settings and
- // reloading could cause multiple prompts to the user for values if a system property was specified with a prompt
- // placeholder
- Settings nodeSettings = Settings.builder()
- .put(settings)
- .put(InternalSettingsPreparer.IGNORE_SYSTEM_PROPERTIES_SETTING.getKey(), true)
- .build();
-
- node = new Node(nodeSettings) {
+ node = new Node(settings) {
@Override
protected void validateNodeBeforeAcceptingRequests(Settings settings, BoundTransportAddress boundTransportAddress) {
BootstrapCheck.check(settings, boundTransportAddress);
@@ -193,13 +185,13 @@ final class Bootstrap {
};
}
- private static Environment initialSettings(boolean foreground, String pidFile) {
+ private static Environment initialSettings(boolean foreground, String pidFile, Map<String, String> esSettings) {
Terminal terminal = foreground ? Terminal.DEFAULT : null;
Settings.Builder builder = Settings.builder();
if (Strings.hasLength(pidFile)) {
builder.put(Environment.PIDFILE_SETTING.getKey(), pidFile);
}
- return InternalSettingsPreparer.prepareEnvironment(builder.build(), terminal);
+ return InternalSettingsPreparer.prepareEnvironment(builder.build(), terminal, esSettings);
}
private void start() {
@@ -233,11 +225,13 @@ final class Bootstrap {
// Set the system property before anything has a chance to trigger its use
initLoggerPrefix();
- elasticsearchSettings(esSettings);
+ // force the class initializer for BootstrapInfo to run before
+ // the security manager is installed
+ BootstrapInfo.init();
INSTANCE = new Bootstrap();
- Environment environment = initialSettings(foreground, pidFile);
+ Environment environment = initialSettings(foreground, pidFile, esSettings);
Settings settings = environment.settings();
LogConfigurator.configure(settings, true);
checkForCustomConfFile();
@@ -295,13 +289,6 @@ final class Bootstrap {
}
}
- @SuppressForbidden(reason = "Sets system properties passed as CLI parameters")
- private static void elasticsearchSettings(Map<String, String> esSettings) {
- for (Map.Entry<String, String> esSetting : esSettings.entrySet()) {
- System.setProperty(esSetting.getKey(), esSetting.getValue());
- }
- }
-
@SuppressForbidden(reason = "System#out")
private static void closeSystOut() {
System.out.close();