2014-12-18 15:40:26 +01:00
|
|
|
# <a id="preferences"></a> Preferences
|
2013-08-02 16:37:47 +02:00
|
|
|
|
2014-12-18 15:40:26 +01:00
|
|
|
Preferences are settings a user can set for his account only, for example his language and time zone.
|
2013-08-02 16:37:47 +02:00
|
|
|
|
2014-12-18 15:40:26 +01:00
|
|
|
**Choosing Where to Store Preferences**
|
2013-08-02 16:37:47 +02:00
|
|
|
|
2014-12-18 15:40:26 +01:00
|
|
|
Preferences can be stored either in INI files or in a MySQL or in a PostgreSQL database. By default, Icinga Web 2 stores
|
|
|
|
preferences in INI files beneath Icinga Web 2's configuration directory.
|
2013-08-02 16:37:47 +02:00
|
|
|
|
2014-12-18 15:40:26 +01:00
|
|
|
## <a id="preferences-configuration"></a> Configuration
|
2013-08-02 16:37:47 +02:00
|
|
|
|
2014-12-18 15:40:26 +01:00
|
|
|
Where to store preferences is defined in the INI file **config/config.ini** in the *preferences* section.
|
2013-08-02 16:37:47 +02:00
|
|
|
|
2014-12-18 15:40:26 +01:00
|
|
|
### <a id="preferences-configuration-ini"></a> Store Preferences in INI Files
|
2013-08-02 16:37:47 +02:00
|
|
|
|
2014-12-18 15:40:26 +01:00
|
|
|
If preferences are stored in INI Files, Icinga Web 2 automatically creates one file per user using the username as
|
|
|
|
file name for storing preferences. A INI file is created once a user saves changed preferences the first time.
|
|
|
|
The files are located beneath the `preferences` directory beneath Icinga Web 2's configuration directory.
|
2013-08-02 16:37:47 +02:00
|
|
|
|
2014-12-18 15:40:26 +01:00
|
|
|
For storing preferences in INI files you have to add the following section to the INI file **config/config.ini**:
|
2013-08-02 16:37:47 +02:00
|
|
|
|
2014-12-18 15:40:26 +01:00
|
|
|
```
|
|
|
|
[preferences]
|
|
|
|
type = ini
|
2016-09-01 14:31:39 +02:00
|
|
|
```
|
2013-08-02 16:37:47 +02:00
|
|
|
|
2014-12-18 15:40:26 +01:00
|
|
|
### <a id="preferences-configuration-db"></a> Store Preferences in a Database
|
2013-08-02 16:37:47 +02:00
|
|
|
|
2014-12-18 15:40:26 +01:00
|
|
|
In order to be more flexible in distributed setups you can store preferences in a MySQL or in a PostgreSQL database.
|
2016-04-13 13:43:39 +02:00
|
|
|
For storing preferences in a database, you have to define a [database resource](04-Resources.md#resources-configuration-database)
|
2014-12-18 15:40:26 +01:00
|
|
|
which will be referenced as resource for the preferences storage.
|
2013-09-02 16:08:17 +02:00
|
|
|
|
2016-09-01 14:18:29 +02:00
|
|
|
| Directive | Description |
|
|
|
|
| ------------- | ----------- |
|
|
|
|
| **type** | `db` |
|
|
|
|
| **resource** | The name of the database resource defined in [resources.ini](04-Resources.md#resources). |
|
2013-09-02 16:08:17 +02:00
|
|
|
|
2014-12-18 15:40:26 +01:00
|
|
|
**Example:**
|
2013-09-02 16:08:17 +02:00
|
|
|
|
2014-12-18 15:40:26 +01:00
|
|
|
```
|
|
|
|
[preferences]
|
|
|
|
type = db
|
|
|
|
resource = icingaweb-mysql
|
|
|
|
```
|
2013-09-02 16:08:17 +02:00
|
|
|
|
2014-12-18 15:40:26 +01:00
|
|
|
#### <a id="preferences-configuration-db-setup"></a> Database Setup
|
2013-08-02 16:37:47 +02:00
|
|
|
|
2014-12-18 15:40:26 +01:00
|
|
|
For storing preferences in a database, you have to import one of the following database schemas:
|
2013-08-02 16:37:47 +02:00
|
|
|
|
2014-12-18 15:40:26 +01:00
|
|
|
* **etc/schema/preferences.mysql.sql** (for **MySQL** database)
|
|
|
|
* **etc/schema/preferences.pgsql.sql** (for **PostgreSQL** databases)
|
2013-08-02 16:37:47 +02:00
|
|
|
|
2016-04-13 13:43:39 +02:00
|
|
|
After that you have to define the [database resource](04-Resources.md#resources-configuration-database).
|