Add options for database string and use it for sockets#7
Add options for database string and use it for sockets#7witchent wants to merge 1 commit intodan-r:mainfrom
Conversation
|
Thanks for your contribution - is there a clear reason for this approach vs. just setting the host to localhost? |
|
Well its twofold:
So I extracted the unix_socket path from the connection string, and then I decided to just extract all options in case at one point someone wants to use other options (like ssl termination etc). This is a very small step up but might make stuff in the future easier. That's how this PR was created. Again, if you don't agree with it I am fine with you closing it/reworking it to just check for empty ports, but I thought I might as well propose it in public, so at least people searching for this problem know how to fix it. Edit:// As for why allowing custom paths could be useful: Apart from my reason (reusing container configurations), I know that some people like to use two mariadb instances for the two databases. Both cannot listen on the same default socket in the syncstorage-container, so one of them has to listen on a non-default socket, making the fallback not work. |
|
Apologies I've left this for so long - planning to take a look at it later today |
I wanted to use your script with a unix socket to connect to mariadb. Most stuff works, but to create the correct tables for the databases I needed to adapt a few things.
Instead of only extracting the unix_socket string, I decided to make it more logical by extracting all options of the mysql:// string and then only use the unix_socket right now. But if in the future one wants to e.g. also accept ssl connections this would now be an easy change.
What I don't like is copying the database-command, so if you have a better idea please feel free to adapt it.
If you don't want to support this usecase this is also fine, then just close it, at least next time somebody wants to do it they can find this PR and see how it could be done.
I tested that change with tcp connection and unix_socket connection and both work fine now.