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]

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值