Skip to content

Commit

Permalink
Load dotenv file from root folder
Browse files Browse the repository at this point in the history
  • Loading branch information
p0lemic committed May 30, 2019
1 parent d4ab5c2 commit 28db8cb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"psr/container": "^1.0",
"sifophp/sifo-common-instance": "^2.14",
"smarty/smarty": "^3.1",
"symfony/dotenv": "^4.3",
"symfony/yaml": "^3.2",
"tpyo/amazon-s3-php-class": "^0.5",
"twig/extensions": "^1.4",
Expand Down
11 changes: 11 additions & 0 deletions src/Sifo/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@

namespace Sifo;

use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\Dotenv\Exception\PathException;

/**
* Configuration file parser.
*/
Expand Down Expand Up @@ -74,6 +77,14 @@ protected function __construct( $instance_name )

include( $this->config_path . $this->configuration_files );
$this->paths_to_configs = $config;

$dotenv = new Dotenv();

try {
$dotenv->load(ROOT_PATH . '/.env');
} catch (PathException $exception) {
return;
}
}

/**
Expand Down

0 comments on commit 28db8cb

Please sign in to comment.