-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Support postgresql connection options #1972
Support postgresql connection options #1972
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.
And please modify the configuration template in drogon_ctl.
8c01bc0
to
77c18cc
Compare
b53d344
to
c1f8f32
Compare
9e4aa60
to
7c022f9
Compare
This PR is suspended for the following reason:
I want to give each database type its own config struct, but I cannot make a good abstraction out of it. Say if we have three struct, But this is a virtual function in However, I found that those three structs having little in common. It would be a meaningless abstraction to extract a base struct. Then I realize the fundamental cause of the problem is that, we should not use a single |
put config to std::variant . how about ?
|
I will give it a try |
4e4a675
to
a980d34
Compare
Use std::variant. Next we should update the |
e177fa8
to
64df11e
Compare
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.
Looks good to me. One minor comment.
@@ -538,9 +538,9 @@ static void loadDbClients(const Json::Value &dbClients) | |||
type.begin(), | |||
[](unsigned char c) { return tolower(c); }); | |||
auto host = client.get("host", "127.0.0.1").asString(); | |||
auto port = client.get("port", 5432).asUInt(); | |||
unsigned short port = client.get("port", 5432).asUInt(); |
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.
We need to check overflow here?
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 think it's unnecessary. We didn't check it before, and we didn't check host format. Even if the number was wrong, one could easily find out reason from log.
If we check it, we must store it in uint type, and do convertion in every config construction.
Only support pg now. Because I don't know this feature about other db.
Use a struct to hold db config. Avoid changing function signature everywhere when adding new parameter.