chore: establish V1.1 recovery baseline
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* App 配置服务(规范 §118 App 配置)
|
||||
*
|
||||
* 拉取服务端下发的业务数量参数(推荐人数、字数上限、Feature Flag 等),
|
||||
* 与 constants/businessLimits.js 的默认值合并,覆盖运行时配置。
|
||||
* 接口失败时保留默认值不变(规范 §119),保证核心流程可用。
|
||||
*/
|
||||
const api = require('../utils/api');
|
||||
const { mergeAppConfig, BUSINESS_LIMITS } = require('../constants');
|
||||
|
||||
/**
|
||||
* 拉取并合并服务端 App 配置
|
||||
* @returns {Promise<typeof BUSINESS_LIMITS>} 合并后的运行时配置(失败时返回默认值)
|
||||
*/
|
||||
async function fetchAppConfig() {
|
||||
try {
|
||||
const overrides = await api.get('/app/config');
|
||||
return mergeAppConfig(overrides);
|
||||
} catch (err) {
|
||||
// 配置接口失败不影响核心流程(规范 §119)
|
||||
return BUSINESS_LIMITS;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
fetchAppConfig,
|
||||
};
|
||||
Reference in New Issue
Block a user