forked from wangziqi/gongxue-base
fix: normalize PNVS SMS provider aliases
This commit is contained in:
@@ -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)',
|
||||
|
||||
Reference in New Issue
Block a user