@@ -64,6 +64,27 @@ public static function loadApplicationConfig()
6464 \Leaf \Vite::config ('build ' , 'public/build ' );
6565 \Leaf \Vite::config ('hotFile ' , 'public/hot ' );
6666 }
67+
68+ Config::attachView (ViewConfig ('viewEngine ' ), 'template ' );
69+
70+ if (ViewConfig ('config ' )) {
71+ call_user_func_array (ViewConfig ('config ' ), [
72+ app ()->template (),
73+ [
74+ 'views ' => AppConfig ('views.path ' ),
75+ 'cache ' => AppConfig ('views.cachePath ' ),
76+ ]
77+ ]);
78+ } else if (method_exists (app ()->template (), 'configure ' )) {
79+ app ()->template ()->configure ([
80+ 'views ' => AppConfig ('views.path ' ),
81+ 'cache ' => AppConfig ('views.cachePath ' ),
82+ ]);
83+ }
84+
85+ if (is_callable (ViewConfig ('extend ' ))) {
86+ call_user_func_array (ViewConfig ('extend ' ), app ()->template ());
87+ }
6788 }
6889 }
6990
@@ -79,12 +100,12 @@ protected static function loadConfig()
79100 'app.down ' => _env ('APP_DOWN ' , false ),
80101 'debug ' => _env ('APP_DEBUG ' , true ),
81102 'log.dir ' => 'storage/logs/ ' ,
82- 'log.enabled ' => true ,
103+ 'log.enabled ' => _env ( ' APP_LOG_ENABLED ' , true ) ,
83104 'log.file ' => 'app.log ' ,
84105 'log.level ' => Log::DEBUG ,
85106 'log.open ' => true ,
86107 'log.writer ' => null ,
87- 'mode ' => ' development ' ,
108+ 'mode ' => _env ( ' APP_ENV ' , ' development ') ,
88109 'views.path ' => ViewsPath (null , false ),
89110 'views.cachePath ' => StoragePath ('framework/views ' )
90111 ],
@@ -95,11 +116,11 @@ protected static function loadConfig()
95116 'timestamps.format ' => 'YYYY-MM-DD HH:mm:ss ' ,
96117 'unique ' => ['email ' ],
97118 'hidden ' => ['field.id ' , 'field.password ' ],
98- 'session ' => true ,
119+ 'session ' => _env ( ' AUTH_SESSION ' , true ) ,
99120 'session.lifetime ' => 60 * 60 * 24 ,
100121 'session.cookie ' => ['secure ' => false , 'httponly ' => true , 'samesite ' => 'lax ' ],
101122 'token.lifetime ' => 60 * 60 * 24 * 365 ,
102- 'token.secret ' => _env ('TOKEN_SECRET ' , '@leaf$MVC*JWT#AUTH.Secret ' ),
123+ 'token.secret ' => _env ('AUTH_TOKEN_SECRET ' , '@leaf$MVC*JWT#AUTH.Secret ' ),
103124 'messages.loginParamsError ' => 'Incorrect credentials! ' ,
104125 'messages.loginPasswordError ' => 'Password is incorrect! ' ,
105126 'password.key ' => 'password ' ,
@@ -111,10 +132,10 @@ protected static function loadConfig()
111132 },
112133 ],
113134 'cors ' => [
114- 'origin ' => ' * ' ,
115- 'methods ' => ' GET,HEAD,PUT,PATCH,POST,DELETE ' ,
116- 'allowedHeaders ' => ' * ' ,
117- 'exposedHeaders ' => '' ,
135+ 'origin ' => _env ( ' CORS_ALLOWED_ORIGINS ' , ' * ' ) ,
136+ 'methods ' => _env ( ' CORS_ALLOWED_METHODS ' , ' GET,HEAD,PUT,PATCH,POST,DELETE ') ,
137+ 'allowedHeaders ' => _env ( ' CORS_ALLOWED_HEADERS ' , ' * ' ) ,
138+ 'exposedHeaders ' => _env ( ' CORS_EXPOSED_HEADERS ' , '' ) ,
118139 'credentials ' => false ,
119140 'maxAge ' => null ,
120141 'preflightContinue ' => false ,
@@ -188,10 +209,11 @@ protected static function loadConfig()
188209 ],
189210 'view ' => [
190211 'viewEngine ' => \Leaf \Blade::class,
191- 'render ' => null ,
192- 'config ' => function ($ config ) {
193- \Leaf \Config::get ('views.blade ' )->configure ($ config ['views ' ], $ config ['cache ' ]);
212+ 'config ' => function ($ engine , $ config ) {
213+ $ engine ->configure ($ config ['views ' ], $ config ['cache ' ]);
194214 },
215+ 'render ' => null ,
216+ 'extend ' => null ,
195217 ],
196218 'mail ' => [
197219 'host ' => _env ('MAIL_HOST ' , 'smtp.mailtrap.io ' ),
0 commit comments