Skip to content

The open source coding agent.

TypeScript

fix: if server password exists, use basic auth for plugin client by default (#17213)

Aiden Clined722026a8dff
diff --git a/packages/opencode/src/plugin/index.ts b/packages/opencode/src/plugin/index.ts
index 1b9d009aae1..8790efac49b 100644
--- a/packages/opencode/src/plugin/index.ts
+++ b/packages/opencode/src/plugin/index.ts
@@ -25,6 +25,11 @@ export namespace Plugin {
const client = createOpencodeClient({
baseUrl: "http://localhost:4096",
directory: Instance.directory,
+ headers: Flag.OPENCODE_SERVER_PASSWORD
+ ? {
+ Authorization: `Basic ${Buffer.from(`${Flag.OPENCODE_SERVER_USERNAME ?? "opencode"}:${Flag.OPENCODE_SERVER_PASSWORD}`).toString("base64")}`,
+ }
+ : undefined,
fetch: async (...args) => Server.Default().fetch(...args),
})
const config = await Config.get()