Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: Error thrown when running DocumentStore.initialize() with an insecure connection when passing AuthOptions, even if no certificate was passed. #412

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

Merged
merged 1 commit into from
Mar 19, 2024

Conversation

vxern
Copy link
Contributor

@vxern vxern commented Feb 12, 2024

This PR fixes an error being thrown when DocumentStore.initialize() is run after creating a DocumentStore passing AuthOptions that do not contain a certificate.

In essence, this means that the user is forced to write the following verbose construction if they have a case where their certificate is possibly undefined:

let store: DocumentStore;
if (certificate) {
	store = new DocumentStore(host, database, { certificate, type: "pfx" });
} else {
	store = new DocumentStore(host, database);
}

store.initialize();

Instead of:

// This interface is agnostic to whether `certificate` is present or not, if it's not provided, it will just assume an insecure connection.
const store = new DocumentStore(host, database, { certificate, type: "pfx" });

store.initialize();

Given that this piece of code currently throws:

const store = new DocumentStore(host, database, { certificate: undefined, type: "pfx" });

store.initialize(); // Throws.

@ppekrol ppekrol requested a review from ml054 February 12, 2024 22:25
@vxern vxern changed the title fix: Error thrown when running DocumentStore.initialise() with an insecure connection when passing AuthOptions, even if no certificate was passed. fix: Error thrown when running DocumentStore.initialize() with an insecure connection when passing AuthOptions, even if no certificate was passed. Feb 27, 2024
@ml054 ml054 merged commit 92e1867 into ravendb:v5.4 Mar 19, 2024
@ml054
Copy link
Contributor

ml054 commented Mar 19, 2024

@vxern Thanks for your contribution. :)

@vxern vxern deleted the fix-options-error branch March 19, 2024 10:35
@vxern
Copy link
Contributor Author

vxern commented Mar 19, 2024

Absolutely, @ml054, thanks for looking into this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants