Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added multi node support for MongoDB #160

Merged
merged 2 commits into from
Jun 9, 2022
Merged

Conversation

TWestling
Copy link
Member

The host setting can now be input as a list of hosts, separated
by a comma. For everyone just inputting one host, there is no change
in functionality.
Made getMongoConnection in MongoDBKnowledgeBase package-private for
testing purposes.

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

The host setting can now be input as a list of hosts, separated
by a comma. For everyone just inputting one host, there is no change
in functionality.
Made getMongoConnection in MongoDBKnowledgeBase package-private for
testing purposes.
@TWestling TWestling requested a review from rsandell May 13, 2022 12:12
hostlist.add(new ServerAddress(host, port));
List<ServerAddress> hostlist = new LinkedList<>();
for (String h: host.split(",")) {
hostlist.add(new ServerAddress(h, port));
Copy link
Member

@rsandell rsandell Jun 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some input sanitation seems to be needed here. For example:

Suggested change
hostlist.add(new ServerAddress(h, port));
h = StringUtils.trimToNull(h);
if (h != null) {
hostlist.add(new ServerAddress(h, port));
}

A future improvement could be to allow each host to have a port specified as well host1:port,hots2:port,...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some input sanitation seems to be needed here. For example:

A future improvement could be to allow each host to have a port specified as well host1:port,hots2:port,...

I concur, that is a good future improvement.

@TWestling TWestling merged commit 1d12c85 into jenkinsci:master Jun 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants