Skip to content

Commit

Permalink
Fixed loading environment files in scam config & typo
Browse files Browse the repository at this point in the history
  • Loading branch information
jzaplet committed Feb 19, 2019
1 parent e330c79 commit c70f220
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions src/Setup/PropelSetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions src/config/scam.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down

0 comments on commit c70f220

Please sign in to comment.