hn-hlw-service/sms/config.js
2026-07-27 11:28:33 +08:00

48 lines
1.6 KiB
JavaScript
Raw Permalink 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.

const defaults = {
baseUrl:
process.env.CONFIG_SMS_BASE_URL || "https://112.33.46.17:37892/sms/",
timeout: Number.parseInt(process.env.CONFIG_SMS_TIMEOUT || "15000", 10),
};
// apId接口账号
// secretKey接口密码
// 接口账号在登入云Mas → 管理 → 接口管理 → 新建短信接口中配置
// sign签名编码可在管理 → 接口管理 → 短信接入用户管理 → 签名下载中查看
// ecName登入云Mas的企业名称
const credentials = {
ecName: process.env.CONFIG_SMS_EC_NAME || "绍兴市同源健康管理有限公司",
apId: process.env.CONFIG_SMS_AP_ID || "youcan",
secretKey: process.env.CONFIG_SMS_SECRET_KEY || "ZYTzyy@2025",
sign: process.env.CONFIG_SMS_SIGN || "AUPEmf38m",
addSerial: process.env.CONFIG_SMS_ADD_SERIAL || "",
};
const verification = {
codeLength: Number.parseInt(process.env.CONFIG_SMS_CODE_LENGTH || "6", 10),
expireSeconds: Number.parseInt(process.env.CONFIG_SMS_CODE_EXPIRE || "300", 10),
resendIntervalSeconds: Number.parseInt(
process.env.CONFIG_SMS_RESEND_INTERVAL || "60",
10
),
maxAttempts: Number.parseInt(
process.env.CONFIG_SMS_VERIFY_MAX_ATTEMPTS || "5",
10
),
template:
process.env.CONFIG_SMS_VERIFY_TEMPLATE ||
"验证码为{code}{expire}分钟内有效,请勿泄露。",
codeSalt: process.env.CONFIG_SMS_CODE_SALT || "youcan-sms",
};
// 当为 true 时跳过实际短信网关发送(用于本地联调)
const gatewayDisabled =
String(process.env.CONFIG_SMS_GATEWAY_DISABLED || "false").toLowerCase() ===
"true";
module.exports = {
defaults,
credentials,
verification,
gatewayDisabled,
};