(key: string, defaultValue?: string)
| 73 | } |
| 74 | |
| 75 | static get(key: string, defaultValue?: string): string { |
| 76 | this.init(); |
| 77 | try { |
| 78 | const stmt = this.db.prepare("SELECT value FROM config WHERE key = ?"); |
| 79 | const row = stmt.get(key) as { value: string } | undefined; |
| 80 | |
| 81 | if (row) { |
| 82 | return row.value; |
| 83 | } |
| 84 | } catch (error) { |
| 85 | console.error("读取配置失败:", error); |
| 86 | } |
| 87 | return defaultValue || DEFAULT_CONFIG[key] || ""; |
| 88 | } |
| 89 | |
| 90 | static set(key: string, value: string): void { |
| 91 | this.init(); |
no test coverage detected