File tree Expand file tree Collapse file tree 2 files changed +13
-12
lines changed Expand file tree Collapse file tree 2 files changed +13
-12
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,6 @@ public function __construct($config = [])
1919 self ::$ app = $ this ;
2020
2121 $ this ->user = null ;
22- $ this ->userClass = $ config ['userClass ' ];
2322 $ this ->request = new Request ();
2423 $ this ->response = new Response ();
2524 $ this ->router = new Router ($ this ->request , $ this ->response );
@@ -40,15 +39,8 @@ public function __construct($config = [])
4039 */
4140 public function LoadSettings ($ config ) {
4241 self ::$ ROOT_DIR = $ config ['root ' ];
43- $ this ->config ['app ' ] = $ config ['app ' ];
44- $ this ->config ['auth ' ] = $ config ['auth ' ];
45- $ this ->config ['environment ' ] = $ config ['environment ' ];
46- $ this ->config ['connections ' ] = $ config ['connections ' ];
47-
48- // Load env file
49- $ dotenv = Dotenv::createImmutable (self ::$ ROOT_DIR );
50- $ env = $ dotenv ->load ();
51- $ this ->config ['env ' ] = $ this ->ToObject ($ env );
42+ $ this ->userClass = $ config ['auth ' ]['userClass ' ];
43+ $ this ->config = $ config ;
5244
5345 // Transform config type (Array) to (Object)
5446 $ this ->config = $ this ->ToObject ($ this ->config );
Original file line number Diff line number Diff line change @@ -20,8 +20,17 @@ public function __construct($config = NULL)
2020 $ default = NULL ;
2121
2222 if (is_string ($ config )) {
23- if ($ config == "ils-local " || $ config == "ils-live " ) {
24- $ default = Application::$ app ->config ->connections ->$ config ;
23+ if ($ config == "ils " ) {
24+ switch (Application::$ app ->config ->env ->APP_ENV ) {
25+ default :
26+ case "local " :
27+ $ default = Application::$ app ->config ->database ->$ ils ->local ;
28+ break ;
29+ case "sandbox " :
30+ case "live " :
31+ $ default = Application::$ app ->config ->database ->$ ils ->live ;
32+ break ;
33+ }
2534 }
2635 }
2736 if (is_null ($ default )) {
You can’t perform that action at this time.
0 commit comments