File tree Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Original file line number Diff line number Diff line change 1+ REDIS_HOST = 127.0.0.1
2+ REDIS_PASSWORD =
3+ REDIS_PORT = 6379
Original file line number Diff line number Diff line change @@ -89,10 +89,15 @@ jobs:
8989
9090 - name : Prepare for environment variables
9191 run : |
92+ cp .env.testing .env
9293 composer dump-autoload
9394
9495 - name : Run Testsuite
9596 run : vendor/bin/pest tests/ --coverage-text --colors=always --coverage-html=coverage --coverage-clover coverage.xml
97+ env :
98+ REDIS_HOST : 127.0.0.1
99+ REDIS_PASSWORD :
100+ REDIS_PORT : 6379
96101
97102 - name : Upload coverage to Codecov
98103 uses : codecov/codecov-action@v2
Original file line number Diff line number Diff line change @@ -18,16 +18,24 @@ public function __construct(array $config = [])
1818 $ this ->type = 'string ' ;
1919 $ this ->score = 0 ;
2020 $ this ->expire = -1 ;
21+
22+ $ options = [
23+ 'parameters ' => [
24+ 'password ' => $ config ['password ' ] ?? getenv ('REDIS_PASSWORD ' ) ?? '' ,
25+ 'database ' => $ config ['database ' ] ?? getenv ('REDIS_DB ' ) ?? 0 ,
26+ ],
27+ ];
2128 $ this ->client = new Client ([
2229 'scheme ' => 'tcp ' ,
23- 'host ' => $ config ['host ' ] ?? '127.0.0.1 ' ,
24- 'port ' => $ config ['port ' ] ?? 6379 ,
25- ]);
30+ 'host ' => $ config ['host ' ] ?? getenv ( ' REDIS_HOST ' ) ?? '127.0.0.1 ' ,
31+ 'port ' => $ config ['port ' ] ?? getenv ( ' REDIS_PORT ' ) ?? 6379 ,
32+ ], $ options );
2633 }
2734
2835 /**
2936 * 调用predis方法.
3037 *
38+ * @param string $name
3139 * @param array $arguments
3240 */
3341 public function __call (string $ name , array $ arguments ): void
You can’t perform that action at this time.
0 commit comments