Allow to configure node name using `node.name` (on top of current `name`), closes #1126.
This commit is contained in:
parent
64054d4057
commit
8bcfce2e26
|
@ -48,6 +48,7 @@ public class DiscoveryNode implements Streamable, Serializable {
|
|||
|
||||
public static Map<String, String> buildCommonNodesAttributes(Settings settings) {
|
||||
Map<String, String> attributes = Maps.newHashMap(settings.getByPrefix("node.").getAsMap());
|
||||
attributes.remove("name"); // name is extracted in other places
|
||||
if (attributes.containsKey("client")) {
|
||||
if (attributes.get("client").equals("false")) {
|
||||
attributes.remove("client"); // this is the default
|
||||
|
|
|
@ -84,8 +84,12 @@ public class InternalSettingsPerparer {
|
|||
// generate the name
|
||||
if (settingsBuilder.get("name") == null) {
|
||||
String name = System.getProperty("name");
|
||||
if (name == null || name.isEmpty())
|
||||
name = Names.randomNodeName(environment.resolveConfig("names.txt"));
|
||||
if (name == null || name.isEmpty()) {
|
||||
name = settingsBuilder.get("node.name");
|
||||
if (name == null || name.isEmpty()) {
|
||||
name = Names.randomNodeName(environment.resolveConfig("names.txt"));
|
||||
}
|
||||
}
|
||||
|
||||
if (name != null) {
|
||||
settingsBuilder.put("name", name);
|
||||
|
|
Loading…
Reference in New Issue