shuzhiren-comfyui/任务队列后端/config/Config.js

23 lines
885 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
import { dirname } from 'path';
// 获取当前模块文件的目录
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
// 使用相对于当前文件的路径(注意:文件在同一个目录下,不需要 ..
const modelPath = path.join(__dirname, 'model.json');
const modelData = JSON.parse(fs.readFileSync(modelPath, 'utf8'));
const platformPath = path.join(__dirname, 'Platform.json');
const platformData = JSON.parse(fs.readFileSync(platformPath, 'utf8'));
const CostPath = path.join(__dirname, 'cost.json');
const CostData = JSON.parse(fs.readFileSync(CostPath, 'utf8'));
// const errorPath = path.join(__dirname, 'error.json');
// const errorData = JSON.parse(fs.readFileSync(errorPath, 'utf8'));
export { modelData, platformData, CostData };