Added definition and usage of the DATA_PATH global const.

master
Ruslan Baidan 2023-10-24 11:40:14 +02:00
parent 3d99019bfc
commit 497ab325f3
3 changed files with 84 additions and 73 deletions

View File

@ -25,6 +25,7 @@ if (!empty($appConfDir)) {
} }
} }
} }
defined('DATA_PATH') or define('DATA_PATH', $dataPath);
return array( return array(
'modules' => array( 'modules' => array(

View File

@ -15,56 +15,56 @@ use Doctrine\DBAL\Driver\PDO\MySQL\Driver;
use Monarc\Core\Service\DoctrineCacheServiceFactory; use Monarc\Core\Service\DoctrineCacheServiceFactory;
use Monarc\Core\Service\DoctrineLoggerFactory; use Monarc\Core\Service\DoctrineLoggerFactory;
$appconfdir = getenv('APP_CONF_DIR') ?: ''; $dataPath = 'data';
if (defined('DATA_PATH')) {
$datapath = "data"; $dataPath = DATA_PATH;
if( ! empty($appconfdir) ){ } elseif (!empty(getenv('APP_CONF_DIR'))) {
$datapath = $appconfdir.'/data'; $dataPath = getenv('APP_CONF_DIR') . '/data';
} }
return array( return [
// DOCTRINE CONF // DOCTRINE CONF
'service_manager' => array( 'service_manager' => [
'factories' => array( 'factories' => [
'doctrine.cache.mycache' => DoctrineCacheServiceFactory::class, 'doctrine.cache.mycache' => DoctrineCacheServiceFactory::class,
'doctrine.monarc_logger' => DoctrineLoggerFactory::class, 'doctrine.monarc_logger' => DoctrineLoggerFactory::class,
), ],
), ],
'doctrine' => array( 'doctrine' => [
'connection' => array( 'connection' => [
'orm_default' => array( 'orm_default' => [
'driverClass' => Driver::class, 'driverClass' => Driver::class,
'params' => array( 'params' => [
'host' => '127.0.0.1', 'host' => '127.0.0.1',
'port' => 3306, 'port' => 3306,
'user' => 'root', 'user' => 'root',
'password' => '', 'password' => '',
'dbname' => 'monarc_common', 'dbname' => 'monarc_common',
'charset' => 'utf8', 'charset' => 'utf8',
'driverOptions' => array( 'driverOptions' => [
PDO::ATTR_STRINGIFY_FETCHES => false, PDO::ATTR_STRINGIFY_FETCHES => false,
PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_EMULATE_PREPARES => false,
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8', PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
), ],
), ],
), ],
'orm_cli' => array( 'orm_cli' => [
'driverClass' => Driver::class, 'driverClass' => Driver::class,
'params' => array( 'params' => [
'host' => '127.0.0.1', 'host' => '127.0.0.1',
'port' => 3306, 'port' => 3306,
'user' => 'root', 'user' => 'root',
'password' => '', 'password' => '',
'dbname' => 'monarc_cli', 'dbname' => 'monarc_cli',
'charset' => 'utf8', 'charset' => 'utf8',
'driverOptions' => array( 'driverOptions' => [
PDO::ATTR_STRINGIFY_FETCHES => false, PDO::ATTR_STRINGIFY_FETCHES => false,
PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_EMULATE_PREPARES => false,
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8', PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
), ],
), ],
), ],
), ],
/*'migrations_configuration' => array( /*'migrations_configuration' => array(
'orm_default' => array( 'orm_default' => array(
'name' => 'Monarc Migrations', 'name' => 'Monarc Migrations',
@ -81,53 +81,55 @@ return array(
'column' => 'version', 'column' => 'version',
), ),
),*/ ),*/
'entitymanager' => array( 'entitymanager' => [
'orm_default' => array( 'orm_default' => [
'connection' => 'orm_default', 'connection' => 'orm_default',
'configuration' => 'orm_default' 'configuration' => 'orm_default',
), ],
'orm_cli' => array( 'orm_cli' => [
'connection' => 'orm_cli', 'connection' => 'orm_cli',
'configuration' => 'orm_cli', 'configuration' => 'orm_cli',
), ],
), ],
'configuration' => array( 'configuration' => [
'orm_default' => array( 'orm_default' => [
'metadata_cache' => 'mycache', 'metadata_cache' => 'mycache',
'query_cache' => 'mycache', 'query_cache' => 'mycache',
'result_cache' => 'mycache', 'result_cache' => 'mycache',
'driver' => 'orm_default', // This driver will be defined later 'driver' => 'orm_default', // This driver will be defined later
'generate_proxies' => true, 'generate_proxies' => true,
'proxy_dir' => $datapath.'/DoctrineORMModule/Proxy', 'proxy_dir' => $dataPath . '/DoctrineORMModule/Proxy',
'proxy_namespace' => 'DoctrineORMModule\Proxy', 'proxy_namespace' => 'DoctrineORMModule\Proxy',
'filters' => array(), 'filters' => [],
'datetime_functions' => array(), 'datetime_functions' => [],
'string_functions' => array(), 'string_functions' => [],
'numeric_functions' => array(), 'numeric_functions' => [],
'second_level_cache' => array(), 'second_level_cache' => [],
'sql_logger' => 'doctrine.monarc_logger', 'sql_logger' => 'doctrine.monarc_logger',
), ],
'orm_cli' => array( 'orm_cli' => [
'metadata_cache' => 'mycache', 'metadata_cache' => 'mycache',
'query_cache' => 'mycache', 'query_cache' => 'mycache',
'result_cache' => 'mycache', 'result_cache' => 'mycache',
'driver' => 'orm_cli', // This driver will be defined later 'driver' => 'orm_cli', // This driver will be defined later
'generate_proxies' => true, 'generate_proxies' => true,
'proxy_dir' => $datapath.'/DoctrineORMModule/Proxy', 'proxy_dir' => $dataPath . '/DoctrineORMModule/Proxy',
'proxy_namespace' => 'DoctrineORMModule\Proxy', 'proxy_namespace' => 'DoctrineORMModule\Proxy',
'filters' => array(), 'filters' => [],
'datetime_functions' => array(), 'datetime_functions' => [],
'string_functions' => array(), 'string_functions' => [],
'numeric_functions' => array(), 'numeric_functions' => [],
'second_level_cache' => array(), 'second_level_cache' => [],
'sql_logger' => 'doctrine.monarc_logger', 'sql_logger' => 'doctrine.monarc_logger',
), ],
), ],
), ],
'spool_path_create' => $datapath . '/json/create/',//default location path where the json file enabling the creation of the environment of the client should be generated 'spool_path_create' => $dataPath . '/json/create/',
'spool_path_delete' => $datapath . '/json/delete/', //default location path where the json file enabling the deletion of the environment of the client should be generated //default location path where the json file enabling the creation of the environment of the client should be generated
'spool_path_update' => $datapath . '/json/update/', 'spool_path_delete' => $dataPath . '/json/delete/',
//default location path where the json file enabling the deletion of the environment of the client should be generated
'spool_path_update' => $dataPath . '/json/update/',
// END DOCTRINE CONF // END DOCTRINE CONF
); ];

View File

@ -10,6 +10,14 @@
* control, so do not include passwords or other sensitive information in this * control, so do not include passwords or other sensitive information in this
* file. * file.
*/ */
$dataPath = 'data';
if (defined('DATA_PATH')) {
$dataPath = DATA_PATH;
} elseif (!empty(getenv('APP_CONF_DIR'))) {
$dataPath = getenv('APP_CONF_DIR') . '/data';
}
return array( return array(
// DOCTRINE CONF // DOCTRINE CONF
'service_manager' => array( 'service_manager' => array(
@ -81,7 +89,7 @@ return array(
'result_cache' => 'mycache', 'result_cache' => 'mycache',
'driver' => 'orm_default', // This driver will be defined later 'driver' => 'orm_default', // This driver will be defined later
'generate_proxies' => true, 'generate_proxies' => true,
'proxy_dir' => 'data/DoctrineORMModule/Proxy', 'proxy_dir' => $dataPath .'data/DoctrineORMModule/Proxy',
'proxy_namespace' => 'DoctrineORMModule\Proxy', 'proxy_namespace' => 'DoctrineORMModule\Proxy',
'filters' => array(), 'filters' => array(),
'datetime_functions' => array(), 'datetime_functions' => array(),
@ -95,7 +103,7 @@ return array(
'result_cache' => 'mycache', 'result_cache' => 'mycache',
'driver' => 'orm_cli', // This driver will be defined later 'driver' => 'orm_cli', // This driver will be defined later
'generate_proxies' => true, 'generate_proxies' => true,
'proxy_dir' => 'data/DoctrineORMModule/Proxy', 'proxy_dir' => $dataPath . 'data/DoctrineORMModule/Proxy',
'proxy_namespace' => 'DoctrineORMModule\Proxy', 'proxy_namespace' => 'DoctrineORMModule\Proxy',
'filters' => array(), 'filters' => array(),
'datetime_functions' => array(), 'datetime_functions' => array(),