28 lines
980 B
TypeScript
28 lines
980 B
TypeScript
/**
|
||
* 飞书应用配置
|
||
* 将敏感信息配置在服务端,避免前端暴露
|
||
*/
|
||
|
||
export const FEISHU_CONFIG = {
|
||
// 默认应用配置 - 从环境变量获取
|
||
DEFAULT_APP_TOKEN: process.env.FEISHU_DEFAULT_APP_TOKEN || 'YDtMbwqBkangyistqmicDAH0nag',
|
||
DEFAULT_TABLE_ID: process.env.FEISHU_DEFAULT_TABLE_ID || 'tblGRc1MSmQfonb2',
|
||
|
||
// 应用凭证 - 从环境变量获取
|
||
APP_ID: process.env.FEISHU_APP_ID || '',
|
||
APP_SECRET: process.env.FEISHU_APP_SECRET || '',
|
||
}
|
||
|
||
/**
|
||
* 获取飞书应用配置
|
||
* @param tableId 可选的表格ID,如果不提供则使用默认配置
|
||
* @returns 返回完整的配置信息(app_token完全从服务端获取)
|
||
*/
|
||
export function getFeishuConfig(tableId?: string) {
|
||
return {
|
||
appToken: FEISHU_CONFIG.DEFAULT_APP_TOKEN, // app_token完全从服务端配置获取,不从前端传递
|
||
tableId: tableId || FEISHU_CONFIG.DEFAULT_TABLE_ID,
|
||
appId: FEISHU_CONFIG.APP_ID,
|
||
appSecret: FEISHU_CONFIG.APP_SECRET,
|
||
}
|
||
} |