-
Notifications
You must be signed in to change notification settings - Fork 174
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
some characters not supported in DATABASE_URL #2149
Comments
Hi @thosil. This is expected behaviour. A URL has a fixed structure for parsing and splitting it into components:
The separators So replacing If you've used https://neon.tech, you might have seen that it uses the account email address as the database username, so it needs to have characters such as
|
Hi @alco , thanks for the answer. But whatever you decide to do with this issue, it would be nice to have another way to specify the credentials (ex: from a file, for docker secrets). Again thanks for the answer :-) |
For maximum compatibility you would need to encode the special characters right? Otherwise you'd need to check every tool you use. It seems easier to just encode? |
Yeah, I would say a good rule of thumb is to always percent-encode URI components to avoid any conflict with reserved characters. The worst that'll happen is you'll get a valid URI that doesn't lead to any ambiguity when parsing. Now, there is room for a deeper discussion on the normative syntax for the userinfo component in PostgreSQL URIs since the official URI spec does not constrain it in any way. But I don't think this repo is the right place for it. I concur with @thosil on the need to have another way to pass secret credentials to Electric and only using |
For the sake of argument, I would like to mention that
But it is an arbitrary decision. What if you generated usernames in your tests and those contained colons? That wouldn't work:
So it's best to make sure you have a valid and unambiguous connection URI with reserved characters percent-encoded before using it. |
Hi there,
I'm testing the latest version at the time I'm writing this (electric 1.0.0-beta.1-4-geeba768), good job!
But I have an issue, my db password has a ":" inside and it looks like the parser don't like it:
It works if I replace the ":" with "%3A" so it's really in the config parser.
The text was updated successfully, but these errors were encountered: