Skip to content

Commit

Permalink
Read .env file of environment
Browse files Browse the repository at this point in the history
Merge pull request #99 from noelamaya/read-env-file-of-environment
  • Loading branch information
p0lemic authored Apr 28, 2021
2 parents c5f238c + 6429669 commit 127dba7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Sifo/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,11 @@ protected function __construct( $instance_name )
include( $this->config_path . $this->configuration_files );
$this->paths_to_configs = $config;

$env_file = (isset($_SERVER['APP_ENV']) && $_SERVER['APP_ENV'] === 'test') ? '.env.test' : '.env';
$dotenv = new Dotenv();

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

0 comments on commit 127dba7

Please sign in to comment.