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

Defaults for DATASOURCE_USER & DATASOURCE_PASSWORD to None #293

Merged
merged 1 commit into from
Jun 29, 2024

Conversation

oh2fih
Copy link
Collaborator

@oh2fih oh2fih commented Jun 29, 2024

Fixes mongo url without user/password after #291.

Cause

The #291 adds this if statement:

if self.config.DATASOURCE_USER is None
and self.config.DATASOURCE_PASSWORD is None

This condition is never met, because those variables have default values and it is impossible to explicitly set them to None, as None from an environment variable is treated as a string instead of Python None Keyword.

Before

DATASOURCE_USER DATASOURCE_PASSWORD self._datasource_connection_details
(unset) (unset) {'host': 'mongodb://cvexplore:[email protected]:27017'}
None None {'host': 'mongodb://None:[email protected]:27017'}

After

DATASOURCE_USER DATASOURCE_PASSWORD self._datasource_connection_details
(unset) (unset) {'host': 'mongodb://127.0.0.1:27017'}
cvexplore password {'host': 'mongodb://cvexplore:[email protected]:27017'}

@P-T-I
Copy link
Member

P-T-I commented Jun 29, 2024

Great! Thanks!

@P-T-I P-T-I merged commit 9329bbd into cve-search:master Jun 29, 2024
3 checks passed
@oh2fih oh2fih deleted the fix-mongo-url-default-credentials branch June 29, 2024 07:47
@oh2fih oh2fih restored the fix-mongo-url-default-credentials branch June 29, 2024 12:46
@oh2fih oh2fih deleted the fix-mongo-url-default-credentials branch June 29, 2024 12:46
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