Implement email config

This commit is contained in:
syuilo 2018-11-29 16:23:45 +09:00
parent 0ce64f8c33
commit 1bc109b42c
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
10 changed files with 280 additions and 13 deletions

View file

@ -228,7 +228,56 @@ export const meta = {
desc: {
'ja-JP': '外部ユーザーレコメンデーションのタイムアウト (ミリ秒)'
}
}
},
enableEmail: {
validator: $.bool.optional,
desc: {
'ja-JP': 'メール配信を有効にするか否か'
}
},
email: {
validator: $.str.optional.nullable,
desc: {
'ja-JP': 'メール配信する際に利用するメールアドレス'
}
},
smtpSecure: {
validator: $.bool.optional,
desc: {
'ja-JP': 'SMTPサーバがSSLを使用しているか否か'
}
},
smtpHost: {
validator: $.str.optional,
desc: {
'ja-JP': 'SMTPサーバのホスト'
}
},
smtpPort: {
validator: $.num.optional,
desc: {
'ja-JP': 'SMTPサーバのポート'
}
},
smtpUser: {
validator: $.str.optional,
desc: {
'ja-JP': 'SMTPサーバのユーザー名'
}
},
smtpPass: {
validator: $.str.optional,
desc: {
'ja-JP': 'SMTPサーバのパスワード'
}
},
}
};
@ -359,6 +408,34 @@ export default define(meta, (ps) => new Promise(async (res, rej) => {
set.externalUserRecommendationTimeout = ps.externalUserRecommendationTimeout;
}
if (ps.enableEmail !== undefined) {
set.enableEmail = ps.enableEmail;
}
if (ps.email !== undefined) {
set.email = ps.email;
}
if (ps.smtpSecure !== undefined) {
set.smtpSecure = ps.smtpSecure;
}
if (ps.smtpHost !== undefined) {
set.smtpHost = ps.smtpHost;
}
if (ps.smtpPort !== undefined) {
set.smtpPort = ps.smtpPort;
}
if (ps.smtpUser !== undefined) {
set.smtpUser = ps.smtpUser;
}
if (ps.smtpPass !== undefined) {
set.smtpPass = ps.smtpPass;
}
await Meta.update({}, {
$set: set
}, { upsert: true });