fix: normalize PNVS SMS provider aliases

This commit is contained in:
Codex
2026-07-04 00:27:56 +08:00
parent a6ffb6b962
commit 3a10daf847
6 changed files with 38 additions and 7 deletions

View File

@@ -12,10 +12,8 @@ const DEFAULT_PLATFORM_ADMIN_API_KEY = 'local-platform-admin-key';
const HARD_MAX_JSON_BODY_BYTES = 50 * 1024 * 1024;
const PRODUCTION_SMS_PROVIDERS = new Set([
'aliyun-pnvs',
'aliyun_pnvs',
'aliyun-pnvs-sms',
'aliyun-sms-auth',
'aliyun_sms_auth',
]);
const PRODUCTION_STORAGE_PROVIDERS = new Set(['aliyun_oss', 'tencent_cos', 'supabase_storage']);
const AUTH_PROVIDER_ALIASES = {
@@ -567,7 +565,7 @@ function validateEnv() {
}
}
const authSmsProvider = env('AUTH_SMS_PROVIDER', 'mock').trim().toLowerCase();
const authSmsProvider = normalizeProvider(env('AUTH_SMS_PROVIDER', 'mock')).replace(/[_\s]/g, '-');
if (!PRODUCTION_SMS_PROVIDERS.has(authSmsProvider)) {
block('env.auth_sms_provider', 'AUTH_SMS_PROVIDER must be aliyun-pnvs in production', {
provider: authSmsProvider || '(empty)',