-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EZP-30750: Added possibility to set purge_type with environmental var…
…iables (#490)
- Loading branch information
Showing
7 changed files
with
109 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?php | ||
|
||
// On Symfony container compilation*, reads parameters from env variables if defined and overrides the yml parameters. | ||
// * For typical use cases like Docker, make sure to recompile Symfony container on run to refresh settings. | ||
|
||
use Symfony\Component\Config\FileLocator; | ||
use Symfony\Component\DependencyInjection\Loader; | ||
|
||
if ($dfsNfsPath = getenv('DFS_NFS_PATH')) { | ||
$container->setParameter('dfs_nfs_path', $dfsNfsPath); | ||
|
||
if ($value = getenv('DFS_DATABASE_DRIVER')) { | ||
$container->setParameter('dfs_database_driver', $value); | ||
} else { | ||
$container->setParameter('dfs_database_driver', $container->getParameter('database_driver')); | ||
} | ||
|
||
if ($value = getenv('DFS_DATABASE_HOST')) { | ||
$container->setParameter('dfs_database_host', $value); | ||
} else { | ||
$container->setParameter('dfs_database_host', $container->getParameter('database_host')); | ||
} | ||
|
||
if ($value = getenv('DFS_DATABASE_PORT')) { | ||
$container->setParameter('dfs_database_port', $value); | ||
} else { | ||
$container->setParameter('dfs_database_port', $container->getParameter('database_port')); | ||
} | ||
|
||
if ($value = getenv('DFS_DATABASE_NAME')) { | ||
$container->setParameter('dfs_database_name', $value); | ||
} else { | ||
$container->setParameter('dfs_database_name', $container->getParameter('database_name')); | ||
} | ||
|
||
if ($value = getenv('DFS_DATABASE_USER')) { | ||
$container->setParameter('dfs_database_user', $value); | ||
} else { | ||
$container->setParameter('dfs_database_user', $container->getParameter('database_user')); | ||
} | ||
|
||
if ($value = getenv('DFS_DATABASE_PASSWORD')) { | ||
$container->setParameter('dfs_database_password', $value); | ||
} else { | ||
$container->setParameter('dfs_database_password', $container->getParameter('database_password')); | ||
} | ||
|
||
$loader = new Loader\YamlFileLoader($container, new FileLocator(dirname(__DIR__).'/dfs')); | ||
$loader->load('dfs.yml'); | ||
} | ||
|
||
// Cache settings | ||
// If CACHE_POOL env variable is set, check if there is a yml file that needs to be loaded for it | ||
if (($pool = getenv('CACHE_POOL')) && file_exists(dirname(__DIR__)."/cache_pool/${pool}.yaml")) { | ||
$loader = new Loader\YamlFileLoader($container, new FileLocator(dirname(__DIR__).'/cache_pool')); | ||
$loader->load($pool.'.yaml'); | ||
} | ||
|
||
// Params that needs to be set at compile time and thus can't use Symfony's env() | ||
if ($purgeType = getenv('HTTPCACHE_PURGE_TYPE')) { | ||
$container->setParameter('purge_type', $purgeType); | ||
} | ||
|
||
if ($value = getenv('MAILER_TRANSPORT')) { | ||
$container->setParameter('mailer_transport', $value); | ||
} | ||
|
||
if ($value = getenv('LOG_TYPE')) { | ||
$container->setParameter('log_type', $value); | ||
} | ||
|
||
if ($value = getenv('SESSION_HANDLER_ID')) { | ||
$container->setParameter('ezplatform.session.handler_id', $value); | ||
} | ||
|
||
if ($value = getenv('SESSION_SAVE_PATH')) { | ||
$container->setParameter('ezplatform.session.save_path', $value); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters