| 82 | fileName: "config.json", |
| 83 | legacyDirs: ["git_manager", "git"], |
| 84 | legacyFiles: [ |
| 85 | { dir: "git_manager", fileName: "config.json" }, |
| 86 | { dir: "git", fileName: "config.json" }, |
| 87 | ], |
| 88 | }); |
| 89 | this.db = await JSONFilePreset<Record<string, any>>( |
| 90 | configPath, |
| 91 | { ...DEFAULT_CONFIG } |
| 92 | ); |
| 93 | this.initialized = true; |
| 94 | } catch (error) { |
| 95 | console.error("[git] 初始化配置失败:", error); |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | static async get(key: string): Promise<string> { |
| 100 | await this.init(); |
| 101 | return this.db?.data[key] ?? DEFAULT_CONFIG[key] ?? ""; |
| 102 | } |