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

Enable Parameter Parsing with Mongo 3.6 Cluster Connection Protocol #64

Merged
merged 2 commits into from May 6, 2019

Conversation

BenedictRasmussen
Copy link
Contributor

@BenedictRasmussen BenedictRasmussen commented May 6, 2019

See this issue. This PR makes parameter parsing for config values check the protocol. If the protocol is Mongo 3.6's new cluster connection protocol (mongodb+srv), create the associated connection string (essentially just dropping the port.)

Resolves #63

Copy link
Owner

@pkosiec pkosiec left a comment

Choose a reason for hiding this comment

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

Thank you very much for the PR. It looks very good! Just one suggestion.

@@ -29,6 +29,13 @@ const dbConfig: SeederDatabaseConfig = {
name: 'database',
};

const dbConfigv3_6: SeederDatabaseConfig = {
Copy link
Owner

Choose a reason for hiding this comment

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

Please move the config object to test case should return valid DB connection URI with Mongo 3.6 protocol:

  it('should return valid DB connection URI with Mongo 3.6 protocol', () => {
      const dbConfig: SeederDatabaseConfig = {
            ...
      };
      const expectedUri = 'mongodb+srv://127.0.0.1/database';
      const uri = databaseConnector.getDbConnectionUri(dbConfig);
      expect(uri).toBe(expectedUri);
  })

Also, please rename it to simply dbConfig.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should be addressed now. Thanks or the feedback!

Copy link
Owner

@pkosiec pkosiec left a comment

Choose a reason for hiding this comment

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

👌 Thanks!

@pkosiec pkosiec merged commit 8a8789b into pkosiec:master May 6, 2019
@pkosiec pkosiec added area/core Refers to Mongo Seeding library 🐛 bug Label used for changelog generation from PRs labels May 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core Refers to Mongo Seeding library 🐛 bug Label used for changelog generation from PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update DB URI Parsing from CLI Params to Allow mongoDB+srv protocol
2 participants