[db] show original client IP in postgres status
This commit is contained in:
parent
ebeb3b6c60
commit
937cef38db
1 changed files with 2 additions and 5 deletions
|
@ -82,11 +82,8 @@ class PostgreSQL extends DBEngine
|
||||||
|
|
||||||
public function init(PDO $db): void
|
public function init(PDO $db): void
|
||||||
{
|
{
|
||||||
if (array_key_exists('REMOTE_ADDR', $_SERVER)) {
|
$addr = array_key_exists('REMOTE_ADDR', $_SERVER) ? get_real_ip() : 'local';
|
||||||
$db->exec("SET application_name TO 'shimmie [{$_SERVER['REMOTE_ADDR']}]';");
|
$db->exec("SET application_name TO 'shimmie [$addr]';");
|
||||||
} else {
|
|
||||||
$db->exec("SET application_name TO 'shimmie [local]';");
|
|
||||||
}
|
|
||||||
if (defined("DATABASE_TIMEOUT")) {
|
if (defined("DATABASE_TIMEOUT")) {
|
||||||
$this->set_timeout($db, DATABASE_TIMEOUT);
|
$this->set_timeout($db, DATABASE_TIMEOUT);
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue