Skip to content

Commit b319319

Browse files
committed
ICM: Cached configs support added.
1 parent c80a1ce commit b319319

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/Mutex.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ public function getStrategy()
3333

3434
switch ($this->command->getMutexStrategy()) {
3535
case 'mysql':
36-
return new MySqlLock(env('DB_USERNAME'), env('DB_PASSWORD'), env('DB_HOST'));
36+
return new MySqlLock(
37+
config('database.connections.mysql.username'),
38+
config('database.connections.mysql.password'),
39+
config('database.connections.mysql.host')
40+
);
3741

3842
case 'redis':
3943
return new PredisRedisLock($this->getRedisClient());

tests/ConsoleMutex/MutexTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@ public function it_supports_mysql_strategy()
5454
$this->command->shouldReceive('getMutexStrategy')->withNoArgs()->once()->andReturn('mysql');
5555

5656
$mutex = new Mutex($this->command);
57-
$expectedStrategy = new MySqlLock(env('DB_USERNAME'), env('DB_PASSWORD'), env('DB_HOST'));
57+
$expectedStrategy = new MySqlLock(
58+
config('database.connections.mysql.username'),
59+
config('database.connections.mysql.password'),
60+
config('database.connections.mysql.host')
61+
);
5862
$this->assertEquals($expectedStrategy, $mutex->getStrategy());
5963
}
6064

0 commit comments

Comments
 (0)