/** * Initializes the builder with the given input settings, and applies settings from the specified map (these settings typically come * from the command line). * * @param output the settings builder to apply the input and default settings to * @param input the input settings * @param esSettings a map from which to apply settings */ static void initializeSettings(final Settings.Builder output, final Settings input, final Map<String, String> esSettings) { output.put(input); output.putProperties(esSettings, Function.identity()); output.replacePropertyPlaceholders(); }
/** * Finish preparing settings by replacing forced settings, prompts, and any defaults that need to be added. * The provided terminal is used to prompt for settings needing to be replaced. */ private static void finalizeSettings(Settings.Builder output, Terminal terminal) { // allow to force set properties based on configuration of the settings provided List<String> forcedSettings = new ArrayList<>(); for (String setting : output.keys()) { if (setting.startsWith("force.")) { forcedSettings.add(setting); } } for (String forcedSetting : forcedSettings) { String value = output.remove(forcedSetting); output.put(forcedSetting.substring("force.".length()), value); } output.replacePropertyPlaceholders(); // put the cluster name if (output.get(ClusterName.CLUSTER_NAME_SETTING.getKey()) == null) { output.put(ClusterName.CLUSTER_NAME_SETTING.getKey(), ClusterName.CLUSTER_NAME_SETTING.getDefault(Settings.EMPTY).value()); } replacePromptPlaceholders(output, terminal); }
/** * Initializes the builder with the given input settings, and applies settings from the specified map (these settings typically come * from the command line). * * @param output the settings builder to apply the input and default settings to * @param input the input settings * @param esSettings a map from which to apply settings */ static void initializeSettings(final Settings.Builder output, final Settings input, final Map<String, String> esSettings) { output.put(input); output.putProperties(esSettings, Function.identity()); output.replacePropertyPlaceholders(); }
return replacePropertyPlaceholders(System::getenv);
settingsBuilder.replacePropertyPlaceholders(); Properties props = new Properties(); for (Map.Entry<String, String> entry : settingsBuilder.build().getAsMap().entrySet()) {
output.put(forcedSetting.substring("force.".length()), value); output.replacePropertyPlaceholders();
/** * Finish preparing settings by replacing forced settings, prompts, and any defaults that need to be added. * The provided terminal is used to prompt for settings needing to be replaced. */ private static void finalizeSettings(Settings.Builder output, Terminal terminal) { // allow to force set properties based on configuration of the settings provided List<String> forcedSettings = new ArrayList<>(); for (String setting : output.keys()) { if (setting.startsWith("force.")) { forcedSettings.add(setting); } } for (String forcedSetting : forcedSettings) { String value = output.remove(forcedSetting); output.put(forcedSetting.substring("force.".length()), value); } output.replacePropertyPlaceholders(); // put the cluster name if (output.get(ClusterName.CLUSTER_NAME_SETTING.getKey()) == null) { output.put(ClusterName.CLUSTER_NAME_SETTING.getKey(), ClusterName.CLUSTER_NAME_SETTING.getDefault(Settings.EMPTY).value()); } replacePromptPlaceholders(output, terminal); }
/** * Finish preparing settings by replacing forced settings, prompts, and any defaults that need to be added. * The provided terminal is used to prompt for settings needing to be replaced. */ private static void finalizeSettings(Settings.Builder output, Terminal terminal) { // allow to force set properties based on configuration of the settings provided List<String> forcedSettings = new ArrayList<>(); for (String setting : output.keys()) { if (setting.startsWith("force.")) { forcedSettings.add(setting); } } for (String forcedSetting : forcedSettings) { String value = output.remove(forcedSetting); output.put(forcedSetting.substring("force.".length()), value); } output.replacePropertyPlaceholders(); // put the cluster name if (output.get(ClusterName.CLUSTER_NAME_SETTING.getKey()) == null) { output.put(ClusterName.CLUSTER_NAME_SETTING.getKey(), ClusterName.CLUSTER_NAME_SETTING.getDefault(Settings.EMPTY).value()); } replacePromptPlaceholders(output, terminal); }
/** * Finish preparing settings by replacing forced settings, prompts, and any defaults that need to be added. * The provided terminal is used to prompt for settings needing to be replaced. */ private static void finalizeSettings(Settings.Builder output, Terminal terminal) { // allow to force set properties based on configuration of the settings provided List<String> forcedSettings = new ArrayList<>(); for (String setting : output.internalMap().keySet()) { if (setting.startsWith("force.")) { forcedSettings.add(setting); } } for (String forcedSetting : forcedSettings) { String value = output.remove(forcedSetting); output.put(forcedSetting.substring("force.".length()), value); } output.replacePropertyPlaceholders(); // put the cluster name if (output.get(ClusterName.CLUSTER_NAME_SETTING.getKey()) == null) { output.put(ClusterName.CLUSTER_NAME_SETTING.getKey(), ClusterName.CLUSTER_NAME_SETTING.getDefault(Settings.EMPTY).value()); } replacePromptPlaceholders(output, terminal); }
/** * Initializes the builder with the given input settings, and loads system properties settings if allowed. * If loadDefaults is true, system property default settings are loaded. */ private static void initializeSettings(Settings.Builder output, Settings input, boolean loadDefaults) { output.put(input); if (useSystemProperties(input)) { if (loadDefaults) { for (String prefix : PROPERTY_DEFAULTS_PREFIXES) { output.putProperties(prefix, System.getProperties()); } } for (String prefix : PROPERTY_PREFIXES) { output.putProperties(prefix, System.getProperties(), PROPERTY_DEFAULTS_PREFIXES); } } output.replacePropertyPlaceholders(); }
/** * Initializes the builder with the given input settings, and applies settings from the specified map (these settings typically come * from the command line). * * @param output the settings builder to apply the input and default settings to * @param input the input settings * @param esSettings a map from which to apply settings */ static void initializeSettings(final Settings.Builder output, final Settings input, final Map<String, String> esSettings) { output.put(input); output.putProperties(esSettings, Function.identity()); output.replacePropertyPlaceholders(); }
/** * Runs across all the settings set on this builder and * replaces {@code ${...}} elements in each setting with * another setting already set on this builder. */ public Builder replacePropertyPlaceholders() { return replacePropertyPlaceholders(System::getenv); }
/** * Runs across all the settings set on this builder and * replaces <tt>${...}</tt> elements in each setting with * another setting already set on this builder. */ public Builder replacePropertyPlaceholders() { return replacePropertyPlaceholders(System::getenv); }
/** * Initializes the builder with the given input settings, and applies settings from the specified map (these settings typically come * from the command line). * * @param output the settings builder to apply the input and default settings to * @param input the input settings * @param esSettings a map from which to apply settings */ static void initializeSettings(final Settings.Builder output, final Settings input, final Map<String, String> esSettings) { output.put(input); output.putProperties(esSettings, Function.identity()); output.replacePropertyPlaceholders(); }
/** * Runs across all the settings set on this builder and * replaces {@code ${...}} elements in each setting with * another setting already set on this builder. */ public Builder replacePropertyPlaceholders() { return replacePropertyPlaceholders(System::getenv); }