RIP config.php hello classes/config.php

Another migration is coming which is going to primarily concern non-docker people (i.e. people who like doing things the hard way).

For everyone else, environment-based configuration is going to become a lot more useful, by including all core tunables (with extensibility for e.g. plugin options).

Here’s the working branch for testing: https://git.tt-rss.org/fox/tt-rss/src/branch/wip-config-object

Unless you’re using compose, you will have to migrate your old config.php defaults into new putenv()-based format like this (keep plugin defines as-is for the time being):

https://git.tt-rss.org/fox/tt-rss/wiki/GlobalConfig

Also, config.php is becoming optional.

Just noticed https://git.tt-rss.org/fox/tt-rss/src/branch/wip-config-object/classes/config.php (for example) is getting blocked by nginx.

yeah it’s a global “just in case” rule from ye olde times. just bear with it.

Are the diggest smtp-settings (smtp server, smtp credentials, smtp security) still to be set by define? I don’t see them in the new config class.

you’re probably thinking of mailer-smtp plugin, i haven’t updated it to new configuration yet. so, yes, defines.

I just migrated my config and what confused me was that the following becomes true as setting:

putenv(‘TTRSS_SINGLE_USER_MODE=false’);
or
putenv(‘TTRSS_SINGLE_USER_MODE=“”’);

I mean the default is false, but I would still like to set it - to be safe from future default changes.
What works is:

putenv(‘TTRSS_SINGLE_USER_MODE=’);

IMHO false should be interpreted as false. :slight_smile:

yeah it’s the same for setting environment via docker. this definitely should be documented, at least.

wiser words were never spoken…

I confess I made a series of bad decisions: the first one being on shared hosting, the second one git updating without really thinking of the consequences nor knowing enough to revert the chanes, the third one not being able to succesfully editing the new config.php in order to have TT-RSS working and being stuck with Exception while creating PDO object:could not find driver

Please do not tell me to use feedly :fearful:

why though? just replace your old

define('DB_USER', 'xxx')

with

putenv("TTRSS_DB_USER=xxx")

that’s it

you pretty much only to migrate DB_ stuff and SELF_URL_PATH, the rest has working defaults.

don’t even need to delete anything from config.php until you’re done migrating, just add putenv()s someplace.

I have updated classes/config.php with db user name and password but still get an exception
Exception while creating PDO object:SQLSTATE[08006] [7] fe_sendauth: no password supplied

disregard, now connection success, but config.php is mandatory
Also, config.php is becoming optional.

Is there any way of not setting one of the consts from the config class? In my old config I had define(‘DB_HOST’, ‘’); which made the driver use a unix socket rather than a TCP network socket.

With the new config not setting that means that it tries to use db as a hostname, setting it to something empty means it is still set as seen in the above post about that always being true rather than false.

For now I’ve got it working by just setting that to localhost, but now it’s using the TCP socket. Not a problem, but just wondered if there’s any way now to make it use the unix socket again.

remember the only supported target configuration is a compose setup, unix sockets are meaningless if database is in a separate container.

also this whole thing sounds like a misguided attempt to optimize things using best techniques of the 1970s. let it go.

No idea which config file to edit in which way now, LOL

SO, I’ve edited my config.php and replaced all options
define(‘OPTION’, ‘falue’);
which have definitions in classes/config.php with
putenv(“OPTION=VALUE”);
All the rest (legacy, I suppose) I left the same. Restarted my nginx, and still cannot get TT-RSS working *HTTP error 500)

Just to make sure I understand, I edit the following lines in the old tt-rss/config.php:

define(‘DB_TYPE’, ‘pgsql’);
define(‘DB_HOST’, ‘localhost’);
define(‘DB_USER’, 'xxx);
define(‘DB_NAME’, ‘xxx’);
define(‘DB_PASS’, ‘xxx’);
define(‘DB_PORT’, ‘5432’);
define(‘SELF_URL_PATH’, ‘https://example.com/tt-rss/’);

with the new syntax and that would be all?
All the other parameters can be left as they are?

Thanks again for bearing with me…

yes, pretty much. don’t forget the prefix (TTRSS_).

You’re right fox, I’ll just forget about the unix sockets. Pointless these days anyway.

Something else though. The documentation in the wiki and examples in config.php-dist you have for pushenv do not have ; on the end. Isn’t that a syntax error in PHP? I’ve had to add ; on the end of all those lines in config.php for it to work.

By bad, mistyped couple of options. TT-RSS seems to be up and running.

yeah, i’ll add the ;. forgot, i guess.