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(
'modules' => array(

View File

@ -15,56 +15,56 @@ use Doctrine\DBAL\Driver\PDO\MySQL\Driver;
use Monarc\Core\Service\DoctrineCacheServiceFactory;
use Monarc\Core\Service\DoctrineLoggerFactory;
$appconfdir = getenv('APP_CONF_DIR') ?: '';
$datapath = "data";
if( ! empty($appconfdir) ){
$datapath = $appconfdir.'/data';
$dataPath = 'data';
if (defined('DATA_PATH')) {
$dataPath = DATA_PATH;
} elseif (!empty(getenv('APP_CONF_DIR'))) {
$dataPath = getenv('APP_CONF_DIR') . '/data';
}
return array(
return [
// DOCTRINE CONF
'service_manager' => array(
'factories' => array(
'service_manager' => [
'factories' => [
'doctrine.cache.mycache' => DoctrineCacheServiceFactory::class,
'doctrine.monarc_logger' => DoctrineLoggerFactory::class,
),
),
'doctrine' => array(
'connection' => array(
'orm_default' => array(
],
],
'doctrine' => [
'connection' => [
'orm_default' => [
'driverClass' => Driver::class,
'params' => array(
'params' => [
'host' => '127.0.0.1',
'port' => 3306,
'user' => 'root',
'password' => '',
'dbname' => 'monarc_common',
'charset' => 'utf8',
'driverOptions' => array(
'driverOptions' => [
PDO::ATTR_STRINGIFY_FETCHES => false,
PDO::ATTR_EMULATE_PREPARES => false,
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
),
),
),
'orm_cli' => array(
],
],
],
'orm_cli' => [
'driverClass' => Driver::class,
'params' => array(
'params' => [
'host' => '127.0.0.1',
'port' => 3306,
'user' => 'root',
'password' => '',
'dbname' => 'monarc_cli',
'charset' => 'utf8',
'driverOptions' => array(
'driverOptions' => [
PDO::ATTR_STRINGIFY_FETCHES => false,
PDO::ATTR_EMULATE_PREPARES => false,
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
),
),
),
),
],
],
],
],
/*'migrations_configuration' => array(
'orm_default' => array(
'name' => 'Monarc Migrations',
@ -81,53 +81,55 @@ return array(
'column' => 'version',
),
),*/
'entitymanager' => array(
'orm_default' => array(
'entitymanager' => [
'orm_default' => [
'connection' => 'orm_default',
'configuration' => 'orm_default'
),
'orm_cli' => array(
'configuration' => 'orm_default',
],
'orm_cli' => [
'connection' => 'orm_cli',
'configuration' => 'orm_cli',
),
),
'configuration' => array(
'orm_default' => array(
],
],
'configuration' => [
'orm_default' => [
'metadata_cache' => 'mycache',
'query_cache' => 'mycache',
'result_cache' => 'mycache',
'driver' => 'orm_default', // This driver will be defined later
'generate_proxies' => true,
'proxy_dir' => $datapath.'/DoctrineORMModule/Proxy',
'proxy_dir' => $dataPath . '/DoctrineORMModule/Proxy',
'proxy_namespace' => 'DoctrineORMModule\Proxy',
'filters' => array(),
'datetime_functions' => array(),
'string_functions' => array(),
'numeric_functions' => array(),
'second_level_cache' => array(),
'filters' => [],
'datetime_functions' => [],
'string_functions' => [],
'numeric_functions' => [],
'second_level_cache' => [],
'sql_logger' => 'doctrine.monarc_logger',
),
'orm_cli' => array(
],
'orm_cli' => [
'metadata_cache' => 'mycache',
'query_cache' => 'mycache',
'result_cache' => 'mycache',
'driver' => 'orm_cli', // This driver will be defined later
'generate_proxies' => true,
'proxy_dir' => $datapath.'/DoctrineORMModule/Proxy',
'proxy_dir' => $dataPath . '/DoctrineORMModule/Proxy',
'proxy_namespace' => 'DoctrineORMModule\Proxy',
'filters' => array(),
'datetime_functions' => array(),
'string_functions' => array(),
'numeric_functions' => array(),
'second_level_cache' => array(),
'filters' => [],
'datetime_functions' => [],
'string_functions' => [],
'numeric_functions' => [],
'second_level_cache' => [],
'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_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/',
'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_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
);
];

View File

@ -10,6 +10,14 @@
* control, so do not include passwords or other sensitive information in this
* file.
*/
$dataPath = 'data';
if (defined('DATA_PATH')) {
$dataPath = DATA_PATH;
} elseif (!empty(getenv('APP_CONF_DIR'))) {
$dataPath = getenv('APP_CONF_DIR') . '/data';
}
return array(
// DOCTRINE CONF
'service_manager' => array(
@ -81,7 +89,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 .'data/DoctrineORMModule/Proxy',
'proxy_namespace' => 'DoctrineORMModule\Proxy',
'filters' => array(),
'datetime_functions' => array(),
@ -95,7 +103,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 . 'data/DoctrineORMModule/Proxy',
'proxy_namespace' => 'DoctrineORMModule\Proxy',
'filters' => array(),
'datetime_functions' => array(),