This commit is contained in:
2017-02-07 16:05:12 +08:00
parent 496aab75e9
commit 54088e3f10
6 changed files with 28 additions and 16 deletions

View File

@ -3,7 +3,7 @@ import KoaBody from 'koa-body'
import KoaSession from 'koa-session2'
import KoaStatic from 'koa-static2'
import {
SystemConfig
System as SystemConfig
} from './config'
import path from 'path'
import MainRoutes from './routes/main-routes'

View File

@ -1,18 +1,23 @@
import path from 'path'
export let SystemConfig = {
// 系统配置
export let System = {
HTTP_server_type: 'http://', // HTTP服务器地址,包含"http://"或"https://"
HTTP_server_host: 'localhost', // HTTP服务器地址,请勿添加"http://"
HTTP_server_port: '3000', // HTTP服务器端口号
System_country: 'zh-cn', // 所在国家的国家代码
System_plugin_path: path.join(__dirname, './plugins'), // 插件路径
Session_Key: 'RESTfulAPI', // 生产环境务必随机设置一个值
mysql_host: 'localhost', // MySQL服务器地址
mysql_user: 'root', // 数据库用户名
mysql_password: 'root', // 数据库密码
mysql_database: 'test', // 数据库名称
mysql_port: 3306, // 数据库端口号
mysql_prefix: 'api_' // 默认"api_"
db_type: 'mysql' // 数据库类型
}
export let DB = {
host: 'localhost', // 服务器地址
port: 3306, // 数据库端口号
username: 'admin', // 数据库用户名
password: 'admin888', // 数据库密码
database: 'development', // 数据库名称
prefix: 'api_' // 默认"api_"
}
export let SendEmail = {

View File

@ -1,9 +1,9 @@
import Sequelize from 'sequelize'
import { SystemConfig } from '../config'
import { DB as DBConfig, System as SystemConfig } from '../config'
export default new Sequelize(SystemConfig.mysql_database, SystemConfig.mysql_user, SystemConfig.mysql_password, {
host: SystemConfig.mysql_host,
dialect: 'mysql',
export default new Sequelize(DBConfig.database, DBConfig.username, DBConfig.password, {
host: DBConfig.host,
dialect: SystemConfig.db_type,
pool: {
max: 50,
min: 0,