fix port issue
This commit is contained in:
@@ -43,6 +43,10 @@ cli.command("", "Start the opencode in interactive mode").action(async () => {
|
|||||||
stdout: "inherit",
|
stdout: "inherit",
|
||||||
stderr: "inherit",
|
stderr: "inherit",
|
||||||
stdin: "inherit",
|
stdin: "inherit",
|
||||||
|
env: {
|
||||||
|
...process.env,
|
||||||
|
OPENCODE_SERVER: server.url.toString(),
|
||||||
|
},
|
||||||
onExit: () => {
|
onExit: () => {
|
||||||
server.stop()
|
server.stop()
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import { Global } from "../global"
|
|||||||
|
|
||||||
export namespace Server {
|
export namespace Server {
|
||||||
const log = Log.create({ service: "server" })
|
const log = Log.create({ service: "server" })
|
||||||
const PORT = 16713
|
|
||||||
|
|
||||||
export type Routes = ReturnType<typeof app>
|
export type Routes = ReturnType<typeof app>
|
||||||
|
|
||||||
@@ -401,7 +400,7 @@ export namespace Server {
|
|||||||
|
|
||||||
export function listen() {
|
export function listen() {
|
||||||
const server = Bun.serve({
|
const server = Bun.serve({
|
||||||
port: PORT,
|
port: 0,
|
||||||
hostname: "0.0.0.0",
|
hostname: "0.0.0.0",
|
||||||
idleTimeout: 0,
|
idleTimeout: 0,
|
||||||
fetch: app().fetch,
|
fetch: app().fetch,
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
url := "http://localhost:16713"
|
url := os.Getenv("OPENCODE_SERVER")
|
||||||
httpClient, err := client.NewClientWithResponses(url)
|
httpClient, err := client.NewClientWithResponses(url)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
slog.Error("Failed to create client", "error", err)
|
slog.Error("Failed to create client", "error", err)
|
||||||
|
|||||||
Reference in New Issue
Block a user