Skip to content
This repository has been archived by the owner on Sep 12, 2019. It is now read-only.

Database URL validation does not accept underscore (_) #66

Open
bartekn opened this issue Jul 31, 2017 · 12 comments
Open

Database URL validation does not accept underscore (_) #66

bartekn opened this issue Jul 31, 2017 · 12 comments

Comments

@bartekn
Copy link
Contributor

bartekn commented Jul 31, 2017

No description provided.

@jedmccaleb jedmccaleb added this to the after port milestone Oct 3, 2017
@ghost
Copy link

ghost commented Nov 16, 2017

@bartekn after port label means that this repo will be moved to go monorepo in near future? I should wait or it's ok try to implement it?

@bartekn
Copy link
Contributor Author

bartekn commented Nov 16, 2017

@dulanov I think we will move first chunk of bridge server code to monorepo next week so let's wait until it happens.

@ghost
Copy link

ghost commented Nov 16, 2017

That's great, I exactly need time to set-up dev env and play around a little bit, furthermore this issue looks quite simple to start from.

@ghost
Copy link

ghost commented Nov 16, 2017

@bartekn do you have some broken database URL examples? bridge_example.cfg & compiance_example.cfg have exactly database URL with underscore:

[database]
type = "mysql"
url = "root:@/gateway_test?parseTime=true"

I reproduced it in Go Playground (example is based on two similar peace of code from bridge/config/config.go, compliance/config/config.go) and it works without problems - https://play.golang.org/p/s-FVPnJalU.

@bartekn
Copy link
Contributor Author

bartekn commented Nov 17, 2017

My bad, I could have explained it better in the issue description. The issue is with username, it doesn't accept usernames with _ but it's a valid name in DB engines.

@ghost
Copy link

ghost commented Nov 18, 2017

Interesting, but it also works - postgresql://other_123:pass_word@localhost:1234/otherdb_123?connect_timeout=10&application_name=myapp (https://play.golang.org/p/wpoJb-smH6). May be some real database URL example to reproduce? Or problem occurs when trying to connect to the database?

@bartekn
Copy link
Contributor Author

bartekn commented Nov 20, 2017

root:pass@/gateway_test?parseTime=true

works

ro_ot:pass@/gateway_test?parseTime=true

doesn't work

@ghost
Copy link

ghost commented Nov 20, 2017

Thank you, so the problem is with schema name which contain underscore (_).

@ghost
Copy link

ghost commented Nov 20, 2017

@bartekn but it's illegal requirement, because:

A valid RFC 3986 URL scheme must consist of "a letter and followed by any combination of letters, digits, > plus ("+"), period ("."), or hyphen ("-")." scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ).

And go impl. exactly follows it - https://github.com/golang/go/blob/master/src/net/url/url.go#L8.

@bartekn
Copy link
Contributor Author

bartekn commented Nov 20, 2017

Yes, but it works without _ and some users are using this like this. So we should either ask users to always include a schema prefix (mysql://) or append it if there is no prefix.

@ghost
Copy link

ghost commented Nov 20, 2017

Now I understand your point. We should add support to not fully specified database URLs, especially for cases than user don't want to specify database schema explicitly, because for example now it's always postgres:// in case of Horizon by default.

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

No branches or pull requests

3 participants
@jedmccaleb @bartekn and others