Skip to content

Commit dccb7b7

Browse files
committed
refactor: Remove unused log paths and simplify server initialization
1 parent 118ccc1 commit dccb7b7

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

src/lib/paths.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,8 @@ import path from "pathe"
44
const APP_DIR = path.join(os.homedir(), ".local", "share", "copilot-api")
55

66
const GITHUB_TOKEN_PATH = path.join(APP_DIR, "github_token")
7-
const LOG_PATH = path.join(APP_DIR, "logs")
8-
const LOG_FILE = path.join(LOG_PATH, "app.log")
97

108
export const PATHS = {
119
APP_DIR,
1210
GITHUB_TOKEN_PATH,
13-
LOG_PATH,
14-
LOG_FILE,
1511
}

src/main.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,30 @@ import { serve, type ServerHandler } from "srvx"
66

77
import { initializeApp } from "./lib/initialization"
88
import { logger } from "./lib/logger"
9-
import { initializePort } from "./lib/port"
109
import { server } from "./server"
1110

12-
export async function runServer(options: {
11+
interface RunServerOptions {
1312
port: number
1413
verbose: boolean
1514
logFile?: string
16-
}): Promise<void> {
15+
}
16+
17+
export async function runServer(options: RunServerOptions): Promise<void> {
1718
if (options.verbose) {
1819
consola.level = 5
1920
consola.info("Verbose logging enabled")
2021
}
2122

22-
const port = await initializePort(options.port)
2323
await logger.initialize(options.logFile)
2424

2525
await initializeApp()
2626

27-
const serverUrl = `http://localhost:${port}`
27+
const serverUrl = `http://localhost:${options.port}`
2828
consola.box(`Server started at ${serverUrl}`)
2929

3030
serve({
3131
fetch: server.fetch as ServerHandler,
32-
port,
32+
port: options.port,
3333
})
3434
}
3535

0 commit comments

Comments
 (0)