Skip to content

Commit d722026

Browse files
authored
fix: if server password exists, use basic auth for plugin client by default (anomalyco#17213)
1 parent 42a5af6 commit d722026

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

packages/opencode/src/plugin/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ export namespace Plugin {
2525
const client = createOpencodeClient({
2626
baseUrl: "http://localhost:4096",
2727
directory: Instance.directory,
28+
headers: Flag.OPENCODE_SERVER_PASSWORD
29+
? {
30+
Authorization: `Basic ${Buffer.from(`${Flag.OPENCODE_SERVER_USERNAME ?? "opencode"}:${Flag.OPENCODE_SERVER_PASSWORD}`).toString("base64")}`,
31+
}
32+
: undefined,
2833
fetch: async (...args) => Server.Default().fetch(...args),
2934
})
3035
const config = await Config.get()

0 commit comments

Comments
 (0)