File tree Expand file tree Collapse file tree 1 file changed +20
-7
lines changed
Expand file tree Collapse file tree 1 file changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -27,23 +27,36 @@ public static function loadApplicationConfig()
2727 {
2828 static ::loadConfig ();
2929
30- auth ()->config (Config::getStatic ('mvc.config.auth ' ));
30+ if (class_exists ('Leaf\Auth ' ) && Config::getStatic ('mvc.config.auth ' )) {
31+ auth ()->config (Config::getStatic ('mvc.config.auth ' ));
32+ }
33+
34+ if (class_exists ('Leaf\Mail ' ) && Config::getStatic ('mvc.config.mail ' )) {
35+ mailer ()->connect (Config::getStatic ('mvc.config.mail ' ));
36+ }
3137
3238 if (php_sapi_name () !== 'cli ' ) {
3339 app ()->config (Config::getStatic ('mvc.config.app ' ));
34- app ()->cors (Config::getStatic ('mvc.config.cors ' ));
40+
41+ if (class_exists ('Leaf\Http\Cors ' ) && Config::getStatic ('mvc.config.cors ' )) {
42+ app ()->cors (Config::getStatic ('mvc.config.cors ' ));
43+ }
44+
45+ if (class_exists ('Leaf\Anchor\CSRF ' ) && Config::getStatic ('mvc.config.csrf ' )) {
46+ $ csrfConfig = Config::getStatic ('mvc.config.csrf ' );
3547
36- if (class_exists ('Leaf\Anchor\CSRF ' )) {
3748 $ csrfEnabled = (
38- Config:: getStatic ( ' mvc.config.csrf ' ) &&
49+ $ csrfConfig &&
3950 Config::getStatic ('mvc.config.auth ' )['session ' ] ?? false
4051 );
4152
42- if (Config:: getStatic ( ' mvc.config.csrf ' ) ['enabled ' ] ?? null !== null ) {
43- $ csrfEnabled = Config:: getStatic ( ' mvc.config.csrf ' ) ['enabled ' ];
53+ if ($ csrfConfig ['enabled ' ] ?? null !== null ) {
54+ $ csrfEnabled = $ csrfConfig ['enabled ' ];
4455 }
4556
46- app ()->csrf (Config::getStatic ('mvc.config.csrf ' ));
57+ if ($ csrfEnabled ) {
58+ app ()->csrf ($ csrfConfig );
59+ }
4760 }
4861
4962 if (class_exists ('Leaf\Vite ' )) {
You can’t perform that action at this time.
0 commit comments