MCPcopy Create free account
hub / github.com/ZToolsCenter/ZTools / loadConfig

Method loadConfig

src/main/core/httpServer.ts:36–50  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

34 }
35
36 public async loadConfig(): Promise<HttpServerConfig> {
37 try {
38 const saved = databaseAPI.dbGet(DB_KEY)
39 if (saved) {
40 this.config = {
41 enabled: saved.enabled ?? false,
42 port: saved.port ?? DEFAULT_PORT,
43 apiKey: saved.apiKey || this.generateApiKey()
44 }
45 }
46 } catch (error) {
47 console.error('[HttpServer] 加载配置失败:', error)
48 }
49 return this.config
50 }
51
52 public async saveConfig(config: Partial<HttpServerConfig>): Promise<HttpServerConfig> {
53 this.config = { ...this.config, ...config }

Callers 1

initMethod · 0.95

Calls 2

generateApiKeyMethod · 0.95
dbGetMethod · 0.45

Tested by

no test coverage detected