Commit 9c1c3212 by 杜文军

配置分离

parent 157aef62
<?php
//日志目录位置
defined('REPORT_LOG_PATH') or define('REPORT_LOG_PATH', dirname($_SERVER['DOCUMENT_ROOT']).'/storage/logs/LogReport/');
define('REPORT_LOG_PATH', dirname(APP_STORAGE_PATH .'/storage/logs/LogReport/'));//项目名
//项目名
defined('REPORT_APP_NAME') or define('REPORT_APP_NAME', 'pur');
defined('REPORT_APP_NAME') or define('REPORT_APP_NAME', 'frq_api');
//单日志文件大小限制
defined('LOG_FILE_SIZE') or define('LOG_FILE_SIZE', 2097152); //2MB
......
<?php
function get_resource_config($type){
if(!isset($GLOBALS['_lx_resource_config'][$type])){
$path = RESOURCE_CONFIG_DIR.'/'.$type.'.ini';
$config = parse_ini_file($path , true);
$GLOBALS['_hz_resource_config'][$type] = $config;
}else{
$config = $GLOBALS['_lx_resource_config'][$type];
}
return $config;
}
function get_resource_config_section($type, $section){
if(!isset($GLOBALS['_lx_resource_config'][$type])){
$path = RESOURCE_CONFIG_DIR.'/'.$type.'.ini';
$type_config = parse_ini_file($path , true);
$GLOBALS['_hz_resource_config'][$type] = $type_config;
$config = $type_config[$section];
}else{
$config = $GLOBALS['_lx_resource_config'][$type][$section];
}
return $config;
}
/*
* 币种价格转换
* @param $price 当前价格
......
......@@ -33,6 +33,23 @@ if (file_exists($compiledPath)) {
require $compiledPath;
}
require __DIR__.'/../app/Http/LogReport.php';
require __DIR__.'/../config/define.php';
require __DIR__.'/../app/Http/function.php';
require __DIR__.'/../config/define.php';
\ No newline at end of file
require __DIR__.'/../app/Http/LogReport.php';
$auto_create_dir = [
APP_STORAGE_PATH . "/framework/sessions",
APP_STORAGE_PATH . "/framework/caches",
APP_STORAGE_PATH . "/framework/views",
APP_STORAGE_PATH . "/app/public",
];
foreach ($auto_create_dir as $create_dir)
{
if (!is_dir($create_dir)){
mkdir($create_dir, 0755, true);
}
}
......@@ -53,11 +53,11 @@ return [
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'host' => get_resource_config_section('db', 'db_cms')['host'],
'database' => get_resource_config_section('db', 'db_cms')['db'],
'username' => get_resource_config_section('db', 'db_cms')['user'],
'password' => get_resource_config_section('db', 'db_cms')['passwd'],
'port' => 3306,
'charset' => 'utf8',
'collation' => 'utf8_general_ci',
'prefix' => '',
......@@ -66,11 +66,11 @@ return [
],
'rfq' => [ //询报价数据库
'driver' => 'mysql',
'host' => env('DB_HOST_RFQ', ''),
'database' => env('DB_DATABASE_RFQ', ''),
'username' => env('DB_USERNAME_RFQ', ''),
'password' => env('DB_PASSWORD_RFQ', ''),
'port' => env('DB_PORT_RFQ', 3306),
'host' => get_resource_config_section('db', 'db_frq')['host'],
'database' => get_resource_config_section('db', 'db_frq')['db'],
'username' => get_resource_config_section('db', 'db_frq')['user'],
'password' => get_resource_config_section('db', 'db_frq')['passwd'],
'port' => 3306,
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => 'lie_',
......@@ -78,57 +78,55 @@ return [
],
'spu' => [ //spu数据库
'driver' => 'mysql',
'host' => env('DB_HOST_SPU', ''),
'database' => env('DB_DATABASE_SPU', ''),
'username' => env('DB_USERNAME_SPU', ''),
'password' => env('DB_PASSWORD_SPU', ''),
'port' => env('DB_PORT_SPU', 3306),
'host' => get_resource_config_section('db', 'db_spu')['host'],
'database' => get_resource_config_section('db', 'db_spu')['db'],
'username' => get_resource_config_section('db', 'db_spu')['user'],
'password' => get_resource_config_section('db', 'db_spu')['passwd'],
'port' => 3306,
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => 'lie_',
'strict' => false,
],
'liexin' => [ //liexin 数据库
'ass' => [ //ass数据库
'driver' => 'mysql',
'host' => env('DB_HOST_LIEXIN', ''),
'database' => env('DB_DATABASE_LIEXIN', ''),
'username' => env('DB_USERNAME_LIEXIN', ''),
'password' => env('DB_PASSWORD_LIEXIN', ''),
'port' => env('DB_PORT_LIEXIN', 3306),
'host' => get_resource_config_section('db', 'db_pool')['host'],
'database' => get_resource_config_section('db', 'db_pool')['db'],
'username' => get_resource_config_section('db', 'db_pool')['user'],
'password' => get_resource_config_section('db', 'db_pool')['passwd'],
'port' => 3306,
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => 'lie_',
'strict' => false,
],
'ass' => [ //ass数据库
'liexin' => [ //liexin 数据库
'driver' => 'mysql',
'host' => env('DB_POOL_HOST', ''),
'database' => env('DB_POOL_DATABASE', ''),
'username' => env('DB_POOL_USERNAME', ''),
'password' => env('DB_POOL_PASSWORD', ''),
'port' => env('DB_POOL_PORT', 3306),
'host' => get_resource_config_section('db', 'db_liexin')['host'],
'database' => get_resource_config_section('db', 'db_liexin')['db'],
'username' => get_resource_config_section('db', 'db_liexin')['user'],
'password' => get_resource_config_section('db', 'db_liexin')['passwd'],
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => 'lie_',
'strict' => false,
],
'rabbitmq' => [
'driver' => 'rabbitmq',
'host' => env('RABBITMQ_HOST', '127.0.0.1'),
'port' => env('RABBITMQ_PORT', 5672),
'vhost' => env('RABBITMQ_VHOST', '/'),
'login' => env('RABBITMQ_LOGIN', 'guest'),
'password' => env('RABBITMQ_PASSWORD', 'guest'),
'queue' => env('RABBITMQ_QUEUE'), // name of the default queue,
'host' => get_resource_config_section('rabbit', 'rabbit')['host'],
'port' => get_resource_config_section('rabbit', 'rabbit')['port'],
'vhost' => get_resource_config_section('rabbit', 'rabbit')['vhost'],
'login' => get_resource_config_section('rabbit', 'rabbit')['user'],
'password' => get_resource_config_section('rabbit', 'rabbit')['passwd'],
'queue' => get_resource_config_section('rabbit', 'rabbit')['queue'], // name of the default queue,
],
'mongodb' => [
'driver' => 'mongodb',
'host' => env('DB_MONGO_HOST', ''),
'database' => env('DB_MONGO_DATABASE', ''),
'username' => env('DB_MONGO_USERNAME', ''),
'password' => env('DB_MONGO_PASSWORD', ''),
'port' => env('DB_MONGO_PORT', 27017),
'host' => get_resource_config_section('rabbit', 'rabbit')['host'],
'database' => get_resource_config_section('rabbit', 'rabbit')['db'],
'username' => get_resource_config_section('rabbit', 'rabbit')['user'],
'password' => get_resource_config_section('rabbit', 'rabbit')['passwd'],
'port' => get_resource_config_section('rabbit', 'rabbit')['port'],
// 'options' => [
// 'database' => 'ichunt' // sets the authentication database required by mongo 3
// ]
......@@ -164,10 +162,11 @@ return [
'cluster' => false,
'default' => [
'host' => env('REDIS_HOST', 'localhost'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'host' => get_resource_config_section('redis', 'frq')['host'],
'password' => get_resource_config_section('redis', 'frq')['passwd'],
'port' => get_resource_config_section('redis', 'frq')['port'],
'database' => 0,
'prefix' =>env('PREFIX','Activity_')
],
],
......
......@@ -8,4 +8,10 @@ define('STATUS_SUCCESS_2',201); //缺少特定的参数
define('STATUS_NEED_LOGIN',100); //需要重新登录
define('STATUS_ILLEGAL_PARAM',300); //操作被拒绝,可能是参数不合法等
define('STATUS_ERROR',400); //列表的数据已被穷尽,没有更多数据
define('STATUS_UNKNOWN',500); //服务器未知错误
\ No newline at end of file
define('STATUS_UNKNOWN',500); //服务器未知错误
// 定义资源配置文件目录
define('RESOURCE_CONFIG_DIR' , '/data/liexin_config');
// 定义日志目录
define('APP_STORAGE_PATH' , '/data/wwwlogs/frq_api');
<?php
$mail_config = get_resource_config('mail');
return [
/*
......@@ -16,7 +17,7 @@ return [
|
*/
'driver' => env('MAIL_DRIVER', 'smtp'),
'driver' => $mail_config['mail']['driver'],
/*
|--------------------------------------------------------------------------
......@@ -29,7 +30,7 @@ return [
|
*/
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'host' => $mail_config['mail']['host'],
/*
|--------------------------------------------------------------------------
......@@ -42,7 +43,7 @@ return [
|
*/
'port' => env('MAIL_PORT', 587),
'port' => $mail_config['mail']['port'],
/*
|--------------------------------------------------------------------------
......@@ -68,7 +69,7 @@ return [
|
*/
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'encryption' => $mail_config['mail']['encryption'],
/*
|--------------------------------------------------------------------------
......@@ -81,7 +82,7 @@ return [
|
*/
'username' => env('MAIL_USERNAME'),
'username' => $mail_config['mail']['user'],
/*
|--------------------------------------------------------------------------
......@@ -94,7 +95,7 @@ return [
|
*/
'password' => env('MAIL_PASSWORD'),
'password' => $mail_config['mail']['passwd'],
/*
|--------------------------------------------------------------------------
......
<?php
return [
$domain_config = get_resource_config('domain');
$allow_origin_str = $domain_config['domain']['allow_origin'];
$allow_origin_list = explode(",", $allow_origin_str);
$s = [
'admin' => ['yyc@ichunt.com'],
'login' => [
'login' => 'http://' . env('LOGIN_DOMAIN', '') . '/login',
'logout'=> 'http://' . env('LOGIN_DOMAIN', '') . '/logout',
'check' => 'http://' . env('LOGIN_DOMAIN', '') . '/api/checklogin',
'search'=> 'http://' . env('LOGIN_DOMAIN', '') . '/api/search',
'dashboard'=>'http://'.env('LOGIN_DOMAIN', '') . '/dashboard',
'login' => $domain_config['domain']['login_domain'] . '/login',
'logout'=> $domain_config['domain']['login_domain'] . '/logout',
'check' => $domain_config['domain']['login_domain'] . '/api/checklogin',
'search'=> $domain_config['domain']['login_domain'] . '/api/search',
'dashboard'=> $domain_config['domain']['login_domain'] . '/dashboard',
],
////////////////232配置////////////////////
// 'export_domain'=>'http://export.liexin.net', //通用导入导出网址
......@@ -15,11 +19,10 @@ return [
// 'export_source_items_id' => "23", //导出来源明细id
////////////////本地配置////////////////////
'export_domain'=>'http://export.liexin.net', //通用导入导出网址
'frqapi_domain' => "http://frq_api.liexin.com", //接口网址
'export_source_items_id' => "23", //导出来源明细id
'export_domain'=> $domain_config['domain']['export_domain'], //通用导入导出网址
'frqapi_domain' => $domain_config['domain']['frqapi_domain'], //接口网址
'company_info_origin'=>[ #原始公司信息
'1'=>[ #内地
'name'=>'猎芯科技有限公司',
......@@ -36,41 +39,29 @@ return [
],
//允许跨域站点
'ALLOW_ORIGIN' => array(
'www.frq.liexin.com' ,
'www.frq.liexin.net' ,
'frq.liexin.net' ,
'lfrq.liexin.net' ,
'frq.liexin.com' ,
'szfrq.liexin.com',
'frq.ichunt.com',
'szfrq.ichunt.com',
'yunxin.ichunt.com',
),
'ALLOW_ORIGIN' => $allow_origin_list,
"cookieDomain" =>".liexin.com",
"domain" => "liexin.net",
'api_domain' => 'http://api.liexin.com/',
"domain" => $domain_config['domain']['domain'],
'api_domain' => $domain_config['domain']['api_domain'],
'frq_export_inquiry' => '23', //导出明细id
'frq_go_server' => 'http://frq.liexin.net', //询价go 对外项目
'frq_url' => 'http://frq.liexin.net',
'frq_go_server' => $domain_config['domain']['frq_go_server'], //询价go 对外项目
'frq_url' => $domain_config['domain']['frq_url'],
// 权限系统
'perm_url' => 'http://perm.liexin.net',
'perm_url' => $domain_config['domain']['perm_url'],
// 获取用户权限接口
'perm_api' => 'http://perm.liexin.net/api/perms/',
'perm_api' => $domain_config['domain']['perm_api'],
// 获取用户许可权限接口
'check_access_api' => 'http://perm.liexin.net/api/perms/access',
'check_access_api' => $domain_config['domain']['check_access_api'],
//上传图片接口地址
'UploadUrl' => 'http://api.liexin.com/oss/upload',
'UploadKey' => 'fh6y5t4rr351d2c3bryi',
'UploadUrl' => $domain_config['upload']['upload_url'],
'UploadKey' => $domain_config['upload']['upload_key'],
];
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment