feat: mail config

pull/663/head
bigfengyu 5 years ago
parent e55941d26b
commit eb1d82f9c5

@ -0,0 +1,7 @@
{
"semi": false,
"trailingComma": "all",
"singleQuote": true,
"printWidth": 100,
"tabWidth": 2
}

@ -4,11 +4,11 @@ const config: IConfigOptions = {
version: 'v2.8.0', version: 'v2.8.0',
serve: { serve: {
port: (process.env.SERVE_PORT && parseInt(process.env.SERVE_PORT)) || 8080, port: (process.env.SERVE_PORT && parseInt(process.env.SERVE_PORT)) || 8080,
path: '' path: '',
}, },
keys: ['some secret hurr'], keys: ['some secret hurr'],
session: { session: {
key: 'rap2:sess' key: 'rap2:sess',
}, },
db: { db: {
dialect: 'mysql', dialect: 'mysql',
@ -20,24 +20,24 @@ const config: IConfigOptions = {
pool: { pool: {
max: 10, max: 10,
min: 0, min: 0,
idle: 10000 idle: 10000,
}, },
logging: false, logging: false,
dialectOptions: { dialectOptions: {
connectTimeout: 20000 connectTimeout: 20000,
} },
}, },
redis: {}, redis: {},
mail: { mail: {
host: 'smtp.aliyun.com', host: process.env.MAIL_HOST ?? 'smtp.aliyun.com',
port: 465, port: process.env.MAIL_PORT ?? 465,
secure: true, secure: process.env.MAIL_SECURE ?? true,
auth: { auth: {
user: 'rap2org@service.alibaba.com', user: process.env.MAIL_USER ?? 'rap2org@service.alibaba.com',
pass: '' pass: process.env.MAIL_PASS ?? '',
} },
}, },
mailSender: 'rap2org@service.alibaba.com' mailSender: process.env.MAIL_SENDER ?? 'rap2org@service.alibaba.com',
} }
export default config export default config

@ -1,45 +1,45 @@
import { IConfigOptions } from "../types" import { IConfigOptions } from '../types'
// 先从环境变量取配置 // 先从环境变量取配置
let config: IConfigOptions = { let config: IConfigOptions = {
version: '2.8.0', version: '2.8.0',
serve: { serve: {
port: (process.env.SERVE_PORT && parseInt(process.env.SERVE_PORT)) || 8080, port: (process.env.SERVE_PORT && parseInt(process.env.SERVE_PORT)) || 8080,
path: '', path: '',
},
keys: ['some secret hurr'],
session: {
key: 'rap2:sess',
},
db: {
dialect: 'mysql',
host: process.env.MYSQL_URL || 'localhost',
port: (process.env.MYSQL_PORT && parseInt(process.env.MYSQL_PORT)) || 3306,
username: process.env.MYSQL_USERNAME || 'root',
password: process.env.MYSQL_PASSWD || '',
database: process.env.MYSQL_SCHEMA || 'rap',
pool: {
max: 80,
min: 0,
idle: 20000,
acquire: 20000,
}, },
keys: ['some secret hurr'], logging: false,
session: { },
key: 'rap2:sess', redis: {
host: process.env.REDIS_URL || 'localhost',
port: (process.env.REDIS_PORT && parseInt(process.env.REDIS_PORT)) || 6379,
},
mail: {
host: process.env.MAIL_HOST ?? 'smtp.aliyun.com',
port: process.env.MAIL_PORT ?? 465,
secure: process.env.MAIL_SECURE ?? true,
auth: {
user: process.env.MAIL_USER ?? 'rap2org@service.alibaba.com',
pass: process.env.MAIL_PASS ?? '',
}, },
db: { },
dialect: 'mysql', mailSender: process.env.MAIL_SENDER ?? 'rap2org@service.alibaba.com',
host: process.env.MYSQL_URL || 'localhost',
port: (process.env.MYSQL_PORT && parseInt(process.env.MYSQL_PORT)) || 3306,
username: process.env.MYSQL_USERNAME || 'root',
password: process.env.MYSQL_PASSWD || '',
database: process.env.MYSQL_SCHEMA || 'rap',
pool: {
max: 80,
min: 0,
idle: 20000,
acquire: 20000,
},
logging: false,
},
redis: {
host: process.env.REDIS_URL || 'localhost',
port: (process.env.REDIS_PORT && parseInt(process.env.REDIS_PORT)) || 6379
},
mail: {
host: 'smtp-mail.outlook.com',
port: 587,
secure: false,
auth: {
user: 'rap2_notify@outlook.com',
pass: ''
}
},
mailSender: 'rap2_notify@outlook.com',
} }
export default config export default config

Loading…
Cancel
Save