-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Maruf Alom
committed
Aug 17, 2020
1 parent
99d8bd8
commit 894ca88
Showing
5 changed files
with
51 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,13 @@ | ||
<?php | ||
|
||
/** | ||
* Configuration for Laravel DejaVu package | ||
* currently it is only PHP Redis by default. | ||
*/ | ||
|
||
/** | ||
* @param string $key | ||
* @return array | ||
*/ | ||
function getRedisServers(string $key): array { | ||
return array_map('trim', explode(',', env($key))); | ||
} | ||
|
||
$sentinelsIp = getRedisServers('REDIS_SENTINELS_IPS'); | ||
$sentinelsPort = getRedisServers('REDIS_SENTINELS_PORTS'); | ||
$sentinelsTimeout = getRedisServers('REDIS_SENTINELS_TIMEOUTS'); | ||
|
||
$sentinels = []; | ||
|
||
foreach ($sentinelsIp as $key => $ip) { | ||
$sentinel['host'] = $ip; | ||
$sentinel['port'] = isset($sentinelsPort[$key]) ? (int)$sentinelsPort[$key] : 26379; | ||
$sentinel['timeout'] = isset($sentinelsTimeout[$key]) ? (float) $sentinelsTimeout[$key] : 1.0; | ||
|
||
$sentinels[] = $sentinel; | ||
} | ||
|
||
|
||
return [ | ||
'redis_auth' => env('REDIS_PASS', ''), | ||
'sentinels' => $sentinels, | ||
'redis_auth' => env('REDIS_PASS', null), | ||
'persistant_id' => env('PERSISTENT_ID', 'dejavu'), | ||
'sentinels_ips' => env('REDIS_SENTINELS_IPS', '172.16.0.11'), | ||
'sentinels_ports' => env('REDIS_SENTINELS_PORTS', '26379'), | ||
'sentinels_timeouts' => env('REDIS_SENTINELS_TIMEOUTS', '26379'), | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters