webadmin系统设置
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { execSync } from 'node:child_process';
|
||||
|
||||
const API = process.env.SMOKE_API ?? 'http://localhost:3000/api/v1';
|
||||
const DEFAULT_MOCK_CODE = process.env.MOCK_SMS_CODE ?? '123456';
|
||||
const REDIS_CONTAINER = process.env.REDIS_CONTAINER ?? 'dukang-v1-redis';
|
||||
|
||||
function sleep(ms) {
|
||||
@@ -33,14 +32,11 @@ export async function loadClientConfig() {
|
||||
}
|
||||
|
||||
export async function resolveSmsCode(phone, scene) {
|
||||
const cfg = await loadClientConfig();
|
||||
if (cfg.mockSms) return DEFAULT_MOCK_CODE;
|
||||
|
||||
const fromRedis = readSmsCodeFromRedis(phone, scene);
|
||||
if (fromRedis) return fromRedis;
|
||||
|
||||
throw new Error(
|
||||
`SMS code not found for ${phone} (${scene}); enable MOCK_SMS or ensure Redis is reachable`,
|
||||
`SMS code not found for ${phone} (${scene}); send SMS first and ensure Redis is reachable`,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user