Replies: 1 comment
-
@Maniload I'm not using Eloquent standalone, but at first glance it looks like addConnection may accept the same values as the config file values in Laravel, since they all end up passed into the PDO connection. So just passing connection parameters in "options". Untested, so I could be wrong. Something like this... $capsule->addConnection([
'driver' => 'pgsql',
// others...,
'options' => [
'connect_timeout' => 10 // Might need PDO::ATTR_TIMEOUT
]
]); If that doesn't work. You might just build them from an array so they're more readable. Something like this... $options = [
'hostaddr' => '12.34.56.78,12.34.56.79',
'target_session_attrs' => 'read-write',
// others...
];
[
'host' => 'host1,host2;' . http_build_query($options, '=', ';')
] |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello 👋,
I'm using Eloquent (standalone) to connect to a Postgres database. Unfortunately I need a few connection options that don't seem to be currently supported by the database connector (
Illuminate\Database\Connectors\PostgresConnector
).The options I need include
hostaddr
,target_session_attrs
,connect_timeout
andsslcompression
. But of course there are even more options defined here that don't seem to be supported.Right now I'm using an ugly workaround that injects the options using the
host
parameter, which looks like this:But maybe I'm just missing something and there is a better way to do this already. Otherwise it would be helpful if there was a way to pass arbitrary connection parameters.
I hope you can help me!
Beta Was this translation helpful? Give feedback.
All reactions