Skip to content

Commit 0abbeb2

Browse files
feat(bootstrapper): add automatic .env loading using codemonster-ru/env
1 parent 3f8fadb commit 0abbeb2

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@
22

33
All notable changes to **codemonster-ru/annabel** will be documented in this file.
44

5+
## [1.9.0] - 2025-11-16
6+
7+
### Added
8+
9+
- Added automatic loading of the .env file via the codemonster-ru/env package during the bootstrap phase.
10+
- Support for application configuration via environment variables (APP_DEBUG, etc.).
11+
- All Annabel services, as well as the codemonster-ru/errors, codemonster-ru/view, and codemonster-ru/xen packages, can now correctly use env().
12+
13+
### Changed
14+
15+
- The Bootstrapper::run() method has been updated: loading of .env now occurs before ErrorHandler initialization, ensuring correct debug mode detection.
16+
- Improved integration with codemonster-ru/errors: detailed debug pages are now automatically enabled when APP_DEBUG=true.
17+
18+
### Fixed
19+
20+
- Fixed an issue where `APP_DEBUG=true` was ignored, and the generic error page was always displayed.
21+
- Fixed cases where ExceptionHandler would not work correctly due to missing env variables.
22+
523
## [1.8.1] - 2025-11-16
624

725
### Fixed

src/Bootstrap/Bootstrapper.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,24 @@ public function __construct(Application $app)
1919

2020
public function run(?View $customView = null): void
2121
{
22+
$this->loadEnv();
2223
$this->registerHelpers();
2324
$this->registerProviders();
2425
$this->initErrorHandler();
2526
$this->initView($customView);
2627
$this->initKernel();
2728
}
2829

30+
protected function loadEnv(): void
31+
{
32+
$basePath = $this->app->getBasePath();
33+
$envFile = $basePath . '/.env';
34+
35+
if (is_file($envFile)) {
36+
\Codemonster\Env\Env::load($envFile);
37+
}
38+
}
39+
2940
protected function registerHelpers(): void
3041
{
3142
$helpersPath = __DIR__ . '/../helpers/*.php';

0 commit comments

Comments
 (0)