Document that it's possible to use unix domain sockets for MySQL and PostgreSQL connections
fixes #9787
This commit is contained in:
parent
411b0cf3ac
commit
2d38eb1650
|
@ -43,12 +43,30 @@ class DbResourceForm extends Form
|
|||
$dbChoices['oci'] = 'Oracle (OCI8)';
|
||||
}
|
||||
$offerPostgres = false;
|
||||
$offerMysql = false;
|
||||
if (isset($formData['db'])) {
|
||||
if ($formData['db'] === 'pgsql') {
|
||||
$offerPostgres = true;
|
||||
} elseif ($formData['db'] === 'mysql') {
|
||||
$offerMysql = true;
|
||||
}
|
||||
} elseif (key($dbChoices) === 'pgsql') {
|
||||
} else {
|
||||
$dbChoice = key($dbChoices);
|
||||
if ($dbChoice === 'pgsql') {
|
||||
$offerPostgres = true;
|
||||
} elseif ($dbChoices === 'mysql') {
|
||||
$offerMysql = true;
|
||||
}
|
||||
}
|
||||
$socketInfo = '';
|
||||
if ($offerPostgres) {
|
||||
$socketInfo = $this->translate(
|
||||
'For using unix domain sockets, specify the path to the unix domain socket directory'
|
||||
);
|
||||
} elseif ($offerMysql) {
|
||||
$socketInfo = $this->translate(
|
||||
'For using unix domain sockets, specify localhost'
|
||||
);
|
||||
}
|
||||
$this->addElement(
|
||||
'text',
|
||||
|
@ -76,7 +94,8 @@ class DbResourceForm extends Form
|
|||
array (
|
||||
'required' => true,
|
||||
'label' => $this->translate('Host'),
|
||||
'description' => $this->translate('The hostname of the database'),
|
||||
'description' => $this->translate('The hostname of the database')
|
||||
. ($socketInfo ? '. ' . $socketInfo : ''),
|
||||
'value' => 'localhost'
|
||||
)
|
||||
);
|
||||
|
|
|
@ -19,21 +19,38 @@ to handle authentication and authorization, monitoring data or user preferences.
|
|||
Directive | Description
|
||||
----------------|------------
|
||||
**type** | `db`
|
||||
**db** | Database management system. Either `mysql` or `pgsql`.
|
||||
**host** | Connect to the database server on the given host.
|
||||
**port** | Port number to use for the connection.
|
||||
**db** | Database management system. In most cases `mysql` or `pgsql`.
|
||||
**host** | Connect to the database server on the given host. For using unix domain sockets, specify `localhost` for MySQL and the path to the unix domain socket directory for PostgreSQL.
|
||||
**port** | Port number to use. Mandatory for connections to a PostgreSQL database.
|
||||
**username** | The username to use when connecting to the server.
|
||||
**password** | The password to use when connecting to the server.
|
||||
**dbname** | The database to use.
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
[icingaweb]
|
||||
````
|
||||
[icingaweb-mysql-tcp]
|
||||
type = db
|
||||
db = mysql
|
||||
host = 127.0.0.1
|
||||
port = 3306
|
||||
username = icingaweb
|
||||
password = icingaweb
|
||||
dbname = icingaweb
|
||||
|
||||
[icingaweb-mysql-socket]
|
||||
type = db
|
||||
db = mysql
|
||||
host = localhost
|
||||
port = 3306
|
||||
username = icingaweb
|
||||
password = icingaweb
|
||||
dbname = icingaweb
|
||||
|
||||
[icingaweb-pgsql-socket]
|
||||
type = db
|
||||
db = pgsql
|
||||
host = /var/run/postgresql
|
||||
port = 5432
|
||||
username = icingaweb
|
||||
password = icingaweb
|
||||
dbname = icingaweb
|
||||
|
|
Loading…
Reference in New Issue