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

LiquibaseMongodbFactory.createLiquibase() check for database name in database connection string is broken #26655

Closed
paloliska opened this issue Jul 11, 2022 · 2 comments · Fixed by #26684

Comments

@paloliska
Copy link

paloliska commented Jul 11, 2022

With mongodb connection string as following:
mongodb+srv://user:[email protected]/?retryWrites=true&w=majority
createLiquibase will fail with
IllegalArgumentException: Database not specified in URL
even if database name is specified.
Maybe
Pattern HAS_DB = Pattern.compile("(mongodb|mongodb\\+srv)://[^/]*/.*");
should support connection string with properties in it.

Also if HAS_DB will pass, createLiquibase() method will just concatenate database name to connection string
connectionString += "/" + this.mongoClientConfig.database....
which will lead to the same exception as database name is placed after connection properties in db url as following:
mongodb+srv://user:[email protected]/?retryWrites=true&w=majority/databaseName

Quarkus version 2.10.2

@quarkus-bot
Copy link

quarkus-bot bot commented Jul 11, 2022

@loicmathieu
Copy link
Contributor

Yes, this implementation was a bit naive.
You can send a PR if you're up to or I can try to find some time later to have a look if nobody else can.

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

Successfully merging a pull request may close this issue.

3 participants