he wei
2024-02-27 24fc2010253463af5266cfb0cec7c87432fbdf6f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const fs = require("fs");
const path = require("path");
 
// 获取配置文件的绝对路径
const configFilePath = path.join(__dirname, "./config.json");
 
// console.log(configFilePath, 'path');
// 读取配置文件内容
const readConfigFile = () => {
  try {
    const configData = fs.readFileSync(configFilePath, "utf-8");
    return JSON.parse(configData);
  } catch (error) {
    console.error("Error reading config file:", error);
    return error;
  }
};
 
module.exports = {
  readConfigFile,
};