File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -22,14 +22,19 @@ public function __construct($request, $origin) {
22
22
session_start ();
23
23
}
24
24
25
+ /**
26
+ * Get ENV Variables
27
+ */
28
+ $ this ->readEnv ();
29
+
25
30
/**
26
31
* Secure the request,
27
32
* then start
28
33
*/
29
34
REQUEST ::init (REQUEST ::secure ($ request ));
30
35
31
36
$ this ->_security = new SECURITY ();
32
- if (env ('ENV ' )=="production " ){
37
+ if (getenv ('ENV ' )=="production " ){
33
38
set_error_handler ($ this ->errorHandler ());
34
39
}
35
40
}
@@ -38,6 +43,21 @@ private function errorHandler(){
38
43
RESPONSE ::return ('Oops, something is broken. ' ,500 );
39
44
}
40
45
46
+ private function readEnv (){
47
+ if (file_exists ( DOC_ROOT . ".env " )){
48
+ $ envFile = fopen (DOC_ROOT . ".env " , "r " );
49
+ $ contents = fread ($ envFile , filesize (DOC_ROOT . ".env " ));
50
+ $ contents = explode ("\n" , $ contents );
51
+ foreach ($ contents as $ key =>$ value ){
52
+ putenv ($ value );
53
+ }
54
+
55
+ echo getenv ("TEST2 " );
56
+
57
+ fclose ($ envFile );
58
+ }
59
+ }
60
+
41
61
public function callAPP () {
42
62
try {
43
63
/**Get routing afer processing */
You can’t perform that action at this time.
0 commit comments