From f9dd0b7d4b3d2f6d3fac357806aaccf500d95ea0 Mon Sep 17 00:00:00 2001 From: Cyril Rouyer Date: Fri, 10 Mar 2017 15:30:47 +0100 Subject: [PATCH] EVO - config : check if APP_CONF_DIR environment variable has been setted and use it has a basedir for the data folder --- config/application.config.php | 4 +++- config/autoload/global.php | 12 ++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/config/application.config.php b/config/application.config.php index 4cfcef3..b8eb04c 100644 --- a/config/application.config.php +++ b/config/application.config.php @@ -9,8 +9,10 @@ $env = getenv('APP_ENV') ?: 'production'; $appconfdir = getenv('APP_CONF_DIR') ? getenv('APP_CONF_DIR') : ''; $confpaths = [ 'config/autoload/{,*.}{global,local}.php' ]; +$datapath = "data"; if( ! empty($appconfdir) ){ $confpaths[] = $appconfdir.'/local.php'; + $datapath = $appconfdir.'/data'; } return array( @@ -30,7 +32,7 @@ return array( 'config_cache_key' => 'c8aaaaa11586f8b1bf5565cc6064e70a', // md5('config_cache_key_monarc') 'module_map_cache_enabled' => ($env == 'production'), 'module_map_cache_key' => '664579376c4dcdcaa0bcdd0f7e7bf25b', // md5('module_map_cache_key_monarc'), - 'cache_dir' => 'data/cache/', + 'cache_dir' => $datapath.'/cache/', 'check_dependencies' => ($env != 'production'), ), ); diff --git a/config/autoload/global.php b/config/autoload/global.php index a5451e4..57fed23 100644 --- a/config/autoload/global.php +++ b/config/autoload/global.php @@ -10,6 +10,14 @@ * control, so do not include passwords or other sensitive information in this * file. */ + +$appconfdir = getenv('APP_CONF_DIR') ? getenv('APP_CONF_DIR') : ''; + +$datapath = "data"; +if( ! empty($appconfdir) ){ + $datapath = $appconfdir.'/data'; +} + return array( // DOCTRINE CONF 'service_manager' => array( @@ -87,7 +95,7 @@ return array( 'result_cache' => 'mycache', 'driver' => 'orm_default', // This driver will be defined later 'generate_proxies' => true, - 'proxy_dir' => 'data/DoctrineORMModule/Proxy', + 'proxy_dir' => $datapath.'/DoctrineORMModule/Proxy', 'proxy_namespace' => 'DoctrineORMModule\Proxy', 'filters' => array(), 'datetime_functions' => array(), @@ -102,7 +110,7 @@ return array( 'result_cache' => 'mycache', 'driver' => 'orm_cli', // This driver will be defined later 'generate_proxies' => true, - 'proxy_dir' => 'data/DoctrineORMModule/Proxy', + 'proxy_dir' => $datapath.'/DoctrineORMModule/Proxy', 'proxy_namespace' => 'DoctrineORMModule\Proxy', 'filters' => array(), 'datetime_functions' => array(),