Welcome Guest, Not a member yet? Register   Sign In
DB failover settings in .env file?
#4

Failover functionality is currently broken because we always throw an exception when there is something wrong with the connection. I prepared a fix for this: https://github.com/codeigniter4/CodeIgniter4/pull/3074 - hopefully it will be accepted soon.

One thing you have to remember when it comes do .env file. You can only override values that are already defined in the original config file - in this case in database.php, so you need to prepare empty variables in failover array.

The other thing is that failover array can have multiple entries so in your .env file it should look something like this:
PHP Code:
database.default.failover.0.hostname secondaryserver.com
database
.default.failover.0.database mydatabase
database
.default.failover.0.username myuser
database
.default.failover.0.password mypass
database
.default.failover.0.DBDriver MySQLi 
Reply


Messages In This Thread
RE: DB failover settings in .env file? - by michalsn - 06-08-2020, 10:36 AM



Theme © iAndrew 2016 - Forum software by © MyBB