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

@ -1,45 +1,45 @@
import { IConfigOptions } from "../types"
import { IConfigOptions } from '../types'
// 先从环境变量取配置
let config: IConfigOptions = {
version: '2.8.0',
serve: {
port: (process.env.SERVE_PORT && parseInt(process.env.SERVE_PORT)) || 8080,
path: '',
let config: IConfigOptions = {
version: '2.8.0',
serve: {
port: (process.env.SERVE_PORT && parseInt(process.env.SERVE_PORT)) || 8080,
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'],
session: {
key: 'rap2:sess',
logging: false,
},
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',
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',
},
mailSender: process.env.MAIL_SENDER ?? 'rap2org@service.alibaba.com',
}
export default config
export default config

Loading…
Cancel
Save