diff --git a/composer.json b/composer.json index a4795b4..23a521a 100644 --- a/composer.json +++ b/composer.json @@ -13,6 +13,7 @@ "minimum-stability" : "stable", "require": { "symfony/console": "^4.1", + "symfony/dotenv": "^4.2", "propel/propel": "^2.0@alpha", "nette/di": "^2.4", "tracy/tracy": "^2.5" diff --git a/src/Setup/PropelSetup.php b/src/Setup/PropelSetup.php index ddb19c5..2d1760c 100644 --- a/src/Setup/PropelSetup.php +++ b/src/Setup/PropelSetup.php @@ -34,7 +34,7 @@ class PropelSetup * @param $content * @return string */ - protected static function replaceEnviromentVariables($content) : string + protected static function replaceEnvironmentVariables($content) : string { preg_match_all("/\:\:getenv\(\'(.*)\'\)/", $content, $result); @@ -63,7 +63,7 @@ public static function getAsArray() : array { $configPath = realpath(self::NEON_CONFIG_PATH); $content = file_get_contents('nette.safe://' . $configPath); - $content = self::replaceEnviromentVariables($content); + $content = self::replaceEnvironmentVariables($content); $config = Neon::decode($content)['wakers-propel']; return $config; diff --git a/src/config/scam.php b/src/config/scam.php index 04d174e..c328855 100644 --- a/src/config/scam.php +++ b/src/config/scam.php @@ -12,6 +12,12 @@ if (php_sapi_name() === 'cli') { + if (file_exists(__DIR__ . '/../../../../../.env')) + { + $dotenv = new \Symfony\Component\Dotenv\Dotenv(); + $dotenv->load(__DIR__ . '/../../../../../.env'); + } + return \Wakers\Propel\Setup\PropelSetup::getAsArray(); }