thinkjs/lib/Conf/config.js
2014-03-28 20:11:53 +08:00

90 lines
4.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 框架默认配置
* 可以在App/Conf/config.js里修改下面的配置值
* @type {Object}
*/
module.exports = {
port: 8360, //启动服务时用的端口
encoding: 'utf8', //编码
pathname_prefix: "", //不解析的pathname前缀
app_tag_on: true, //是否支持标签功能
url_resource_on: true, //是否监听静态资源类请求
url_resource_reg: /^(resource\/|static\/|favicon\.ico)/, //判断是否是静态资源的正则
post_json_content_type: ["application/json"], //post数据为json时的content-type
url_route_on: true, //开启自定义路由功能
url_html_suffix: ".html", //url后缀这样可以做到伪静态对搜索引擎更友好
app_group_list: ["Home", "Admin"], //分组列表
default_group: 'Home', //默认分组
default_controller: 'Index', //默认模块
default_action: 'index', //默认Action
call_method: "__call", //当找不到方法时调用什么方法,这个方法存在时才有效
before_action_name: "__before", //调用一个action前调用的方法会将action名传递进去
after_action_name: "__after", //调用一个action之后调用的方法会将action名传递进去
url_params_bind: true, //方法参数绑定,将URL参数值绑定到action的参数上
action_suffix: "Action", //action后缀
deny_remote_access_by_ip: false, //禁止通过外网的IP直接访问
url_callback_name: "callback", //jsonp格式的callback名字
json_content_type: "application/json", //发送json时的content-type
auto_send_content_type: true, //是否自动发送Content-Type,默认值为`tpl_content_type`配置值
empty_controller_event: "", //controller不存在时处理的自定义事件可以在Common/common.js里通过E函数注册自定义事件
log_process_pid: true, //记录进程的id,方便其他脚本处理。
use_cluster: false, //是否使用cluster默认不使用0为cpu的数量可以自定义值
autoload_path: {}, //autoload查找的path用于thinkRequire加载自定义库的时候查找
error_tpl_path: THINK_PATH + "/View/error.html", //错误页模版
error_no_key: "errno", //错误number的key
error_msg_key: "errmsg", //错误消息的key
use_websocket: false, //是否使用websocket
deny_ip: [], //阻止的ip
cookie_domain: "", //cookie有效域名
cookie_path: "", //cookie路径
cookie_expires: 0, //cookie默认保持时间数默认随浏览器关闭失效
session_id: "thinkjs", //session id
session_type: "File", //session存储类型, 空为内存还可以为File
session_options: {}, //session的一些选项
session_cookie_sign: "", //session对应的cookie使用签名,如果使用这里填密钥
load_ext_config: [], //加载额外的配置文件 CONF_PATH
load_ext_file: [], //加载额外的文件 COMMON_PATH
db_type: "mysql", // 数据库类型
db_host: "localhost",// 服务器地址
db_name: "",// 数据库名
db_user: "root",// 用户名
db_pwd: "",// 密码
db_port: "",// 端口
db_prefix: "think_",// 数据库表前缀
db_fieldtype_check: false,// 是否进行字段类型检查
db_fields_cache: true, // 启用字段缓存
db_charset: "utf8", // 数据库编码默认采用utf8
db_nums_per_page: 20, //默认每页显示的条数
db_like_fields: "", //自动进行模糊查询,|连接,如: title|content
db_cache_on: true, //是否启用查询缓存
tpl_content_type: "text/html", //模版输出类型
tpl_file_suffix: ".html", //模版文件名后缀
tpl_file_depr: "_", //controller和action之间的分隔符
tpl_engine_type: "ejs", //模版引擎名称
tpl_engine_config: {}, //模版引擎需要的配置
log_record: false, //是否记录日志
data_cache_type: "File", //数据缓存类型,支持:File|true
data_cache_time: 0, //数据缓存有效期0表示永久缓存,单位: 秒
data_cache_prefix: "", //缓存前缀
data_cache_check: false, //数据缓存是否校验缓存
data_cache_path: CACHE_PATH, //缓存路径设置 (仅对File方式缓存有效)
data_path_level: 1, // 子目录缓存级别,默认不使用子目录 (仅对File方式缓存有效)
data_file_suffix: ".json", //缓存文件后缀 (仅对File方式缓存有效)
memcache_host: "127.0.0.1", //memcache host
memcache_port: 11211, //memecache端口
html_cache_on: false, //HTML静态缓存
html_cache_time: 3600, //缓存时间,单位为秒
html_cache_rules: {}, //缓存规则
html_cache_file_callback: undefined, //生成缓存文件的回调函数
html_cache_file_suffix: ".html", //缓存文件后缀名
};