From 2057951ea68319c39be6623094f1d401bd11ad15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Duli=C3=A7i?= Date: Tue, 1 Jun 2021 10:02:46 +0300 Subject: [PATCH] allow to have separate db host for read and write --- config/database.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/config/database.php b/config/database.php index 7705047d0..7029265cf 100644 --- a/config/database.php +++ b/config/database.php @@ -46,7 +46,17 @@ return [ 'mysql' => [ 'driver' => 'mysql', 'url' => env('DATABASE_URL'), - 'host' => env('DB_HOST', '127.0.0.1'), + 'read' => [ + 'host' => [ + env('DB_HOST_READ', env('DB_HOST', '127.0.0.1')), + ], + ], + 'write' => [ + 'host' => [ + env('DB_HOST_WRITE', env('DB_HOST', '127.0.0.1')), + ], + ], + 'sticky' => env('DB_STICKY', true), 'port' => env('DB_PORT', '3306'), 'database' => env('DB_DATABASE', 'forge'), 'username' => env('DB_USERNAME', 'forge'),