Reputation: 528
I'm using Redis to store user-defined config for my Laravel app. I want to know how can I separate the Redis database is being used while testing from the one that is going to be used in for production? That's because I need to flush Redis before each test case and I don't want this to touch my data in main (production) Redis database.
Upvotes: 0
Views: 919
Reputation: 10166
You can use a different Redis database. In your config/database.php
:
'default' => [
[
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => env('REDIS_DB', 0),
],
],
You can set a different REDIS_DB
in your .env.testing
(e.g. REDIS_DB=1
)
Upvotes: 1