(key: string, fallback?: string)
| 75 | throw error; |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | static get(key: string, fallback?: string): string { |
| 80 | this.ensureInit(); |
| 81 | try { |
| 82 | const stmt = this.db!.prepare("SELECT value FROM config WHERE key = ?"); |
| 83 | const row = stmt.get(key) as { value: string } | undefined; |
| 84 | if (row && typeof row.value === "string") { |
| 85 | return row.value; |
| 86 | } |
| 87 | } catch (error) { |
| 88 | console.error("aitc plugin failed to read config", error); |
| 89 | } |
| 90 | if (fallback !== undefined) return fallback; |
| 91 | return DEFAULT_CONFIG[key] ?? ""; |
| 92 | } |
| 93 |
no test coverage detected