File tree Expand file tree Collapse file tree 1 file changed +24
-4
lines changed Expand file tree Collapse file tree 1 file changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -25,17 +25,37 @@ class MailCatcher extends Module
25
25
* Initialize from configuration.
26
26
*/
27
27
public function _initialize ()
28
+ {
29
+ if (isset ($ this ->config ['fromEnv ' ]) && $ this ->config ['fromEnv ' ]) {
30
+ $ this ->loadFromEnv ();
31
+ } else {
32
+ $ this ->loadFromConfig ();
33
+ }
34
+
35
+ if (isset ($ this ->config ['resetBeforeEachTest ' ])) {
36
+ $ this ->resetBeforeEachTest = $ this ->config ['resetBeforeEachTest ' ];
37
+ }
38
+ }
39
+
40
+ private function loadFromEnv ()
28
41
{
29
42
if (isset ($ this ->config ['url ' ])) {
30
- $ this ->url = trim ($ this ->config ['url ' ], '/ ' );
43
+ $ this ->url = trim (getenv ( $ this ->config ['url ' ]) , '/ ' );
31
44
}
32
45
33
46
if (isset ($ this ->config ['port ' ])) {
34
- $ this ->port = $ this ->config ['port ' ];
47
+ $ this ->port = getenv ( $ this ->config ['port ' ]) ;
35
48
}
49
+ }
36
50
37
- if (isset ($ this ->config ['resetBeforeEachTest ' ])) {
38
- $ this ->resetBeforeEachTest = $ this ->config ['resetBeforeEachTest ' ];
51
+ private function loadFromConfig ()
52
+ {
53
+ if (isset ($ this ->config ['url ' ])) {
54
+ $ this ->url = trim ($ this ->config ['url ' ], '/ ' );
55
+ }
56
+
57
+ if (isset ($ this ->config ['port ' ])) {
58
+ $ this ->port = $ this ->config ['port ' ];
39
59
}
40
60
}
41
61
You can’t perform that action at this time.
0 commit comments