summaryrefslogtreecommitdiff
path: root/GlobalConfig.md
blob: 19001721be910851c2d4cff99e49aaf3ff76f46c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
% Global configuration

Preferred method to adjust tt-rss global configuration options is through the environment, i.e. through `.env` when using Compose setup. 

Alternatively, you can use `config.php` (copied from `config.php-dist`) to adjust the defaults. Use the following syntax (options are declared in `classes/config.php`, prefixed by `TTRSS_`):

```php
putenv('TTRSS_DB_HOST=myserver');
putenv('TTRSS_SELF_URL_PATH=http://example.com/tt-rss');
putenv('TTRSS_SESSION_COOKIE_LIFETIME='.(86400*30));
```

Note the lack of quotes around values. Plugin-required constants also go here, using `define()`:

```php
define('LEGACY_CONSTANT', 'value');
```

To set evaluated values via `putenv()` you have to get them evaluated by PHP, this would work:

```php
putenv('TTRSS_SESSION_COOKIE_LIFETIME='.(86400*30));
```

And both of those won't give you expected results:

```php
putenv("TTRSS_SESSION_COOKIE_LIFETIME='2592000'");
# => 0, because '2592000' is an invalid number

putenv(‘TTRSS_SESSION_COOKIE_LIFETIME=86400*30’);
# => 86400, because expression is not evaluated, so you're just casting a string literal "86400*30" to integer
```

Note that all values should be precomputed when setting via `.env` because they are not evaluated by PHP and used as-is.

## Migrating from old-style config.php

For any `config.php` settings you have changed from the defaults (normally this is the `DB_` group of settings and `SELF_URL_PATH`, replace as follows, using the rules above:

`define('DB_PORT', 'xxx')` -> `putenv('TTRSS_DB_PORT=xxx')`.

You can safely omit any settings that were at default values.

[This thread](https://community.tt-rss.org/t/rip-config-php-hello-classes-config-php/4337/30) has relevant discussion and many examples.

## Available settings

All settings (including default values, see `_DEFAULTS[]`) are listed here:

https://git.tt-rss.org/fox/tt-rss/src/branch/master/classes/config.php#L54