diff --git a/app.php b/app.php index 1eebad8..27794a6 100755 --- a/app.php +++ b/app.php @@ -25,6 +25,21 @@ if (file_exists(__DIR__ . '/vendor/autoload.php')) { use App\MigrationRunner; +// Загрузка переменных окружения +if (file_exists(__DIR__ . '/.env')) { + $lines = file(__DIR__ . '/.env', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); + foreach ($lines as $line) { + if (strpos($line, '=') !== false && strpos($line, '#') !== 0) { + list($key, $value) = explode('=', $line, 2); + $key = trim($key); + $value = trim($value); + if (!isset($_ENV[$key])) { + $_ENV[$key] = $value; + } + } + } +} + // Загрузка конфигурации БД $config = require_once __DIR__ . '/config/database.php'; diff --git a/config/database.php b/config/database.php index ed5027a..f330d44 100644 --- a/config/database.php +++ b/config/database.php @@ -1,12 +1,26 @@ $_ENV['DB_HOST'] ?? 'localhost', - 'database' => $_ENV['DB_NAME'] ?? 'rss_hub', - 'username' => $_ENV['DB_USER'] ?? 'rss_hub_user', - 'password' => $_ENV['DB_PASS'] ?? 'secure_password', + 'database' => $_ENV['DB_NAME'] ?? 'rsshub', + 'username' => $_ENV['DB_USER'] ?? 'rsshub', + 'password' => $_ENV['DB_PASS'] ?? 'rsshub_moloko22', 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', 'options' => [