-
Notifications
You must be signed in to change notification settings - Fork 16
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
Fix URL parsing without port #50
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lovely work! Thank you! I've left one small note inline, and if you could update the changelog also that would be fab.
src/pog.gleam
Outdated
@@ -224,6 +224,10 @@ pub fn default_config() -> Config { | |||
/// Parse a database url into configuration that can be used to start a pool. | |||
pub fn url_config(database_url: String) -> Result(Config, Nil) { | |||
use uri <- result.then(uri.parse(database_url)) | |||
let uri = case uri.port { | |||
Some(_) -> uri | |||
None -> Uri(..uri, port: Some(default_config().port)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than building the default config and then accessing the port let's move the default port to a private const
and reference that in both places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I will make this change and update the changelog shortly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made this change and updated the changelog.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Fixes #49
This is my first PR to this repo, please let me know if I missed anything. I wasn't sure if I should add this to the changelog.