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

Database hostnames with underscores are not supported #1602

Closed
David-COUDRAY opened this issue Nov 6, 2023 · 5 comments
Closed

Database hostnames with underscores are not supported #1602

David-COUDRAY opened this issue Nov 6, 2023 · 5 comments

Comments

@David-COUDRAY
Copy link

🐛 Bug Report

DataBase server name (hostname) with underscore refused into DATABASE_URI.

Error message with Postgres :
URI::InvalidURIError: the scheme postgres does not accept registry part: user:pass@dbhost (or bad hostname?)

Error message with MySQL/MariaDB :
URI::InvalidURIError: the scheme mysql2 does not accept registry part: user:pass@dbhost (or bad hostname?)

I use Docker Swarm for HA and fail-over.
By default, docker swarm (like docker compose) assigns the hostname on docker container with the stack name and service name, like this: stack-name_service-name

On Ruby, hostname with underscore is rejected.
See this answer: https://stackoverflow.com/a/64344976/18188311
RFC3986_Parser Ruby class: https://github.com/ruby/ruby/blob/master/lib/uri/rfc3986_parser.rb#L5

Environment

Where are you running/using Password Pusher?

  • [ x ] Docker Image
    • [ x ] pwpush-mysql
    • [ x ] pwpush-postgres

If applicable, what version of Password Pusher? Latest

📈 Expected behavior

I spent over 4 hours trying to figure out why it wasn't working.
I think it would be nice to add a note on the Github redme, as well as in the docker-compose file.

Copy link

github-actions bot commented Nov 6, 2023

Hello @David-COUDRAY, thanks for contributing to the Password Pusher community! We will respond as soon as possible.

@David-COUDRAY David-COUDRAY changed the title DataBase Server DB hostname with underscrore Nov 6, 2023
@pglombardo
Copy link
Owner

Wow that's an unfortunate bug. Thanks for identifying this @David-COUDRAY. I'll add a note to the README as suggested to hopefully save others from the headache.

@pglombardo pglombardo changed the title DB hostname with underscrore Database hostnames with underscores are not supported Nov 7, 2023
@pglombardo
Copy link
Owner

I created the Guide to DATABASE_URL with notes on this issue and underscores. It's linked in the README and I'll start linking it around more as time goes on.

@David-COUDRAY
Copy link
Author

Thank you for this @pglombardo ;-)

@pglombardo
Copy link
Owner

Hi @David-COUDRAY - this was a very helpful report. Since this is now well documented in the project I'll close the issue out. Thanks for reporting!

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

No branches or pull requests

2 participants