feishu-bridge 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2788,17 +2788,50 @@ var FeishuBridge = class {
2788
2788
  };
2789
2789
 
2790
2790
  // src/index.ts
2791
+ var fs9 = __toESM(require("fs"));
2792
+ var path9 = __toESM(require("path"));
2793
+ var os9 = __toESM(require("os"));
2794
+ function loadConfigFromFile() {
2795
+ const configPath = path9.join(os9.homedir(), ".config", "feishu-bridge", "config.json");
2796
+ if (fs9.existsSync(configPath)) {
2797
+ try {
2798
+ const content = fs9.readFileSync(configPath, "utf-8");
2799
+ return JSON.parse(content);
2800
+ } catch (error) {
2801
+ logger.error("Error reading config file:", error);
2802
+ }
2803
+ }
2804
+ return {};
2805
+ }
2791
2806
  async function main() {
2792
2807
  try {
2793
2808
  const configManager = ConfigManager.getInstance();
2794
2809
  const config = { ...DEFAULT_CONFIG };
2810
+ const fileConfig = loadConfigFromFile();
2811
+ if (fileConfig.feishu) {
2812
+ config.feishu = { ...config.feishu, ...fileConfig.feishu };
2813
+ }
2814
+ if (fileConfig.server) {
2815
+ config.server = { ...config.server, ...fileConfig.server };
2816
+ }
2817
+ if (fileConfig.adapters) {
2818
+ config.adapters = { ...config.adapters, ...fileConfig.adapters };
2819
+ }
2820
+ if (fileConfig.behavior) {
2821
+ config.behavior = { ...config.behavior, ...fileConfig.behavior };
2822
+ }
2795
2823
  const appId = process.env.FEISHU_APP_ID;
2796
2824
  const appSecret = process.env.FEISHU_APP_SECRET;
2797
- if (appId && appSecret) {
2825
+ if (appId) {
2798
2826
  config.feishu.appId = appId;
2827
+ }
2828
+ if (appSecret) {
2799
2829
  config.feishu.appSecret = appSecret;
2800
- } else {
2801
- logger.warn("FEISHU_APP_ID and/or FEISHU_APP_SECRET not set in environment variables");
2830
+ }
2831
+ if (!config.feishu.appId || !config.feishu.appSecret) {
2832
+ logger.warn("FEISHU_APP_ID and/or FEISHU_APP_SECRET not set. Please configure using:");
2833
+ logger.warn(" feishu-bridge config set feishu.appId <your-app-id>");
2834
+ logger.warn(" feishu-bridge config set feishu.appSecret <your-app-secret>");
2802
2835
  }
2803
2836
  configManager.load(config);
2804
2837
  const bridge = new FeishuBridge();