It is often annoying to declare several sessions that share the same connection parameters with different users. They must declare the same session builder every time. What would be nice would be a list of profiles (login, passwords etc.) and a list of session configurations (host, db name, connection settings etc).
$pomm = new Pomm(
[
'session_1' =>
[
'dsn' => 'pgsql://host:5432/db_name',
'pomm:default' => true,
'class:session_builder' => '\Some\Class',
'default_profile' => 'my_profile',
],
'session_2' => …
],
[
'my_profile' => ['username' => 'unpriv_user', 'password' => 'p4ßw0rD'],
'administrator' => ['username' => 'postgres', 'password' => 'p4ßw0rD'],
]
);
$session = $pomm->getDefaultSession(); // Default session (1) with default profile
$session = $pomm['session_1']; // Session 1 with default profile
$session = $pomm->getSession('session_1'); // same as above
$session = $pomm->getSession('session_1', 'administrator'); // session 1 with administrator privileges.
Of course the old form of DSN would still be available and inline the default profile to use.
$pomm = new Pomm(
[
'session_1' =>
[
'dsn' => 'pgsql://user:p4sS@host:5432/db_name',
]
],
[
'administrator' => ['username' => 'postgres', 'password' => 'p4ßw0rD'],
]
);
$session = $pomm->getSession('session_1', 'administrator');
Any thoughts ?
It is often annoying to declare several sessions that share the same connection parameters with different users. They must declare the same session builder every time. What would be nice would be a list of profiles (login, passwords etc.) and a list of session configurations (host, db name, connection settings etc).
Of course the old form of DSN would still be available and inline the default profile to use.
Any thoughts ?