Index-Conf

<?php

error_reporting(E_ERROR);

$origin = empty($_SERVER['HTTP_ORIGIN']) ? '*' : $_SERVER['HTTP_ORIGIN'];
header('Access-Control-Allow-Origin:' . $origin);
header('Access-Control-Allow-Credentials: true');
header('Access-Control-Allow-Headers:x-requested-with,content-type,token,lang');
header('Access-Control-Allow-Methods:GET,POST,PUT,DELETE,OPTIONS');
if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') {
    die('{"code":"200","message":"OK"}');
}
define('DS', DIRECTORY_SEPARATOR);
/* INI配置文件支持常量替換 */
define('MYPATH', dirname(__FILE__));
$uri = filter_input(INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_SPECIAL_CHARS);
preg_match('/\/([a-zA-Z0-9\.]+)\/([a-zA-Z0-9\_\-]+)([\/|\?].*?)?$/ie', $uri, $out);

$module = ucfirst($out[1]);

if (!in_array(strtolower($module), ['v2', 'v3', 'api2', 'app', 'api3', 'mall', 'api', 'mobile'])) {
    die('{"code":"-1","message":"模塊不存在!"}');
}

if (file_exists(MYPATH . DS . 'application' . DS . $module) && $module) {
    define('APPLICATION_PATH', MYPATH . DS . 'application' . DS . $module);
    define('CONF_PATH', MYPATH . DS . 'application' . DS . $module . DS . 'conf');
} else {
    die('{"code":"-1","message":"系統錯誤!"}');
}
define('COMMON_PATH', MYPATH . DS . 'common');
$environments = ['pro', 'beta', 'dev'];
$application_path = APPLICATION_PATH . DS . 'conf' . DS . 'application.ini';
foreach ($environments as $environment) {
    if (file_exists('/var/conf/' . $environment)) {
        define('CONFBDP', $environment);
        $application_path = APPLICATION_PATH . DS . 'conf' . DS . 'application_' . $environment . '.ini';
        break;
    }
}

if (!defined('CONFBDP')) {
    define('CONFBDP', 'local');
}

#added by liujf, 2018-01-25
define('COMMON_CONF_PATH', COMMON_PATH . DS . 'conf');
define('CONTROLLER_NAME', ucfirst($out[2]));

/**
 * 默認的, Yaf_Application將會讀取配置文件中在php.ini中設置的ap.environ的配置節
 * 另外在配置文件中, 可以替換PHP的常量, 比如此處的APPLICATION_PATH
 */
$application = new Yaf_Application($application_path);

#SSO登陸驗證 added by zhengkq
if ($module == 'V2' || $module == 'App' || $module == 'V3') {
    $config = $application->getConfig();
    require_once('common/library/Erui/Common/SSOClient.php');
    Erui\Common\SSOClient::Start($config->ssoServer);
}
/* 如果打開flushIstantly, 則視圖渲染結果會直接發送給請求端
 * 而不會寫入Response對象
 */
//$application->getDispatcher()->flushInstantly(TRUE);
//Yaf_Dispatcher::getInstance()->catchException(TRUE);
/* 如果沒有關閉自動response(通過Yaf_Dispatcher::getInstance()->returnResponse(TRUE)),
 * 則$response會被自動輸出, 此處也不需要再次輸出Response
 */

//error_reporting(E_ALL & E_STRICT);
$response = $application
        ->bootstrap()/* bootstrap是可選的調用 */
        ->run()/* 執行 */;
?>
[common]
application.directory = APPLICATION_PATH
application.library = APPLICATION_PATH "/library"
application.modules = Index
;可以任意加載多個類和函數用,隔開例如:application.autolibrary = 'job,common';application.autofunction = 'pro,function'
application.autolibrary = 'common'
application.autofunction = 'function'
;如果不想開啓可以不用配置
application.view.ext = html
;database
;數據庫驅動類型
database.config.type = 'pdo'
;服務器地址
database.config.host = '172.18.**.***'
;database.config.host = 'localhost'
;數據庫名
database.config.name = '**'
database.config.goods.name = '**'
database.config.goods.tablePrefix = ''
database.config.buyer.name = '**'
database.config.buyer.tablePrefix = ''
;用戶名
database.config.user = 'root'
;密碼
;database.config.pwd = '**'
;端口
database.config.port = '3306'
;啓用字段緩存
database.config.fields_cache = false
;數據庫編碼默認採用utf8
database.config.charset = 'utf8'
;數據庫部署方式:0 集中式(單一服務器),1 分佈式(主從服務器)
database.config.deploy_type = 0
;數據庫讀寫是否分離 主從式有效
database.config.rw_separate = false
;讀寫分離後 主服務器數量
database.config.master_num = 1
;指定從服務器序號
database.config.slave_no = ''
database.config.dsn = ''
database.config.params = ''
database.config.bind_param = false
database.config.like_fields = ''
;mongodb
mongodb.config.type = 'mongo'
mongodb.config.host = '172.18.**.**'
mongodb.config.name = 'regi'
mongodb.config.user = 'regi'
mongodb.config.pwd = '**'
mongodb.config.port = '27017'
[product : common]
;upload配置
upload.config.maxSize = '1024 * 1024 * 10'
upload.config.rootPath = MYPATH
upload.config.savePath = "/Uploads/"
;ftp配置
ftp.config.host = "192.168.**.**"
ftp.config.username = "root"
ftp.config.password = "root"
;redis配置
redis.config.server = "172.18.**.***"
redis.config.auth = "123456"
redis.config.port = "6379"
redis.config.dbname = "2"
;數據庫連接池配置
DbServer.async = true
DbServer.multiprocess = false
DbServer.pool_num = 20
DbServer.port = 9501
DbServer.logfile = MYPATH "/server/log/DbServer.log"
DbServer.localip = "localhost"
;rpc服務器配置
rpc.ServerIp = "0.0.0.0"
rpc.port = "9505"
rpc.host = "127.0.0.1"
;日誌設置
log.record = false
log.dir = APPLICATION_PATH "/logs"
;vmstat服務器配置
vmstat.ServerIp = "0.0.0.0"
vmstat.port = "9502"
vmstat.logfile = MYPATH "/server/log/vmstat.log"
;直播服務器配置
live.ServerIp = "0.0.0.0"
live.port = "9503"
live.logfile = MYPATH "/server/log/live.log"
;分佈式服務器通訊配置
distributed.redisserver = "localhost"
distributed.redisport = "6379";
distributed.ServerIp = "0.0.0.0"
distributed.port = "9504"
distributed.logfile = MYPATH "/server/log/distributed.log"
;任務服務器配置
task.ServerIp = "0.0.0.0"
task.port = "9506"
task.logfile = MYPATH "/server/log/task.log"
;hprose服務配置
hprose.ServerIp = "127.0.0.1"
hprose.port = "95188"
;tokenkey值
;tokenkey = "****************"
;saltkey = "***************************************"
;tokenalg = "HS256"
tokenkey = "*******************"
tokenalg = "HS256"
;fastDFS訪問地址
fastDFSUrl = "http://file01.***.com/"
;sso_服務器地址
ssoServer = "http://sso.***dev.com/api/checkToken"
;當前域名
myhost = "http://172.18.**.***:9090/"
;ES api
esapi = "172.18.**.***:9200,172.18.**.***:9200"

;短信接口
smsUrl = "http://msg.***.com/api/sms/"

mail.host    = "smtp.mxhichina.com"
mail.password  = 'Service*MailIt'
mail.username  = "newsletter@***.com"
mail.setfrom  = 'newsletter@***.com'
mail.port  = '25'
shop.url  = 'http://172.18.**.***:88/'
;郵件接口
email.url = "http://msg.***.com/api/email/plain/"
;    mail.user = newsletter@***.com
;mail.password = Service*ItMail
;信保地址
ediserver.host = "**************"
;信保端口號
ediserver.port = "8086"
;信保保險單號
ediserver.policyno = "SCH043954-181800"
[develop : product : common]

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章