Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
localzet committed Apr 19, 2024
1 parent a8ddf30 commit 8421446
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
13 changes: 4 additions & 9 deletions support/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@
* For any questions, please contact <creator@localzet.com>
*/

use Dotenv\Dotenv;
use support\App;
use support\Container;
use support\Events;
use support\Log;
use Triangle\Engine\Bootstrap\BootstrapInterface;
use Triangle\Engine\Config;
use Triangle\Engine\Environment;
use Triangle\Engine\Middleware;
use Triangle\Engine\Router;

Expand Down Expand Up @@ -61,17 +62,11 @@ function ($start_time) {
}

// Загрузка переменных окружения из файла .env
if (class_exists('Dotenv\Dotenv') && file_exists(base_path(false) . '/.env')) {
if (method_exists('Dotenv\Dotenv', 'createUnsafeMutable')) {
Dotenv::createUnsafeMutable(base_path(false))->load();
} else {
Dotenv::createMutable(base_path(false))->load();
}
}
Environment::load(run_path());

// Очистка конфигурации
Config::clear();
support\App::loadAllConfig(['route']);
App::loadAllConfig(['route']);

// Установка часового пояса по умолчанию
date_default_timezone_set(config('app.default_timezone', 'Europe/Moscow'));
Expand Down
6 changes: 3 additions & 3 deletions support/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
use localzet\Server\Connection\TcpConnection;
use localzet\Server\Protocols\Http\Session;
use support\Container;
use support\Env;
use support\Response;
use support\Translation;
use Triangle\Engine\App;
use Triangle\Engine\Config;
use Triangle\Engine\Environment;
use Triangle\Engine\Http\Request;
use Triangle\Engine\Router;
use Triangle\Engine\View\Blade;
Expand All @@ -43,7 +43,7 @@
use Twig\Error\RuntimeError;
use Twig\Error\SyntaxError;

define('BASE_PATH', dirname(__DIR__));
define('BASE_PATH', str_contains(__DIR__, '/vendor/triangle/engine/') ? dirname(__DIR__, 5) : dirname(__DIR__));

/** RESPONSE HELPERS */

Expand Down Expand Up @@ -460,7 +460,7 @@ function config(string $key = null, mixed $default = null): mixed
*/
function env(string $key = null, mixed $default = null): mixed
{
return Env::get($key, $default);
return Environment::get($key, $default);
}

/**
Expand Down

0 comments on commit 8421446

Please sign in to comment.