(key: string, value: string)
| 195 | legacyFiles: [{ dir: "sshkey", fileName: "sshkey_config.json" }], |
| 196 | }); |
| 197 | this.db = await JSONFilePreset<Record<string, any>>( |
| 198 | this.configPath, |
| 199 | { ...DEFAULT_CONFIG } |
| 200 | ); |
| 201 | this.initialized = true; |
| 202 | } catch (error) { |
| 203 | console.error("[ssh] 初始化配置失败:", error); |
| 204 | } finally { |
| 205 | this.initLock = false; |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | static async get(key: string, defaultValue?: string): Promise<string> { |
| 210 | await this.init(); |
| 211 | if (!this.db) return defaultValue || DEFAULT_CONFIG[key] || ""; |
no test coverage detected