Fix #39
This commit is contained in:
@@ -63,13 +63,13 @@ Feature: Not crashing Behat
|
|||||||
default:
|
default:
|
||||||
extensions:
|
extensions:
|
||||||
FriendsOfBehat\SymfonyExtension:
|
FriendsOfBehat\SymfonyExtension:
|
||||||
env_file: .env_in_memory
|
env_file: ../config/.env_in_memory
|
||||||
kernel:
|
kernel:
|
||||||
path: src/MyKernel.php
|
path: src/MyKernel.php
|
||||||
class: MyKernel
|
class: MyKernel
|
||||||
bootstrap: ~
|
bootstrap: ~
|
||||||
"""
|
"""
|
||||||
And a file ".env_in_memory" containing:
|
And a file "../config/.env_in_memory" containing:
|
||||||
"""
|
"""
|
||||||
APP_ENV=dev
|
APP_ENV=dev
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -115,8 +115,9 @@ final class SymfonyExtension implements Extension
|
|||||||
public function load(ContainerBuilder $container, array $config): void
|
public function load(ContainerBuilder $container, array $config): void
|
||||||
{
|
{
|
||||||
if (null !== $config['env_file']) {
|
if (null !== $config['env_file']) {
|
||||||
$envFile = file_exists($config['env_file']) ? $config['env_file'] : $config['env_file'].'.dist';
|
$envFilePath = sprintf('%s/%s', $container->getParameter('paths.base'), $config['env_file']);
|
||||||
$this->loadEnvVars($container, $envFile);
|
$envFilePath = file_exists($envFilePath) ? $envFilePath : $envFilePath.'.dist';
|
||||||
|
(new Dotenv())->load($envFilePath);
|
||||||
|
|
||||||
$environment = false !== getenv('APP_ENV') ? getenv('APP_ENV') : self::DEFAULT_ENV;
|
$environment = false !== getenv('APP_ENV') ? getenv('APP_ENV') : self::DEFAULT_ENV;
|
||||||
$debugMode = false !== getenv('APP_DEBUG') ? getenv('APP_DEBUG') : self::DEBUG_MODE;
|
$debugMode = false !== getenv('APP_DEBUG') ? getenv('APP_DEBUG') : self::DEBUG_MODE;
|
||||||
@@ -144,16 +145,6 @@ final class SymfonyExtension implements Extension
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ContainerBuilder $container
|
|
||||||
* @param string $fileName
|
|
||||||
*/
|
|
||||||
private function loadEnvVars(ContainerBuilder $container, string $fileName): void
|
|
||||||
{
|
|
||||||
$envFilePath = sprintf('%s/%s', $container->getParameter('paths.base'), $fileName);
|
|
||||||
(new Dotenv())->load($envFilePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ContainerBuilder $container
|
* @param ContainerBuilder $container
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user