fix other commands
This commit is contained in:
parent
031766efa0
commit
b1db69fdf7
3 changed files with 19 additions and 10 deletions
|
|
@ -2,6 +2,7 @@ import { Server } from "../../server/server"
|
||||||
import { cmd } from "./cmd"
|
import { cmd } from "./cmd"
|
||||||
import { withNetworkOptions, resolveNetworkOptions } from "../network"
|
import { withNetworkOptions, resolveNetworkOptions } from "../network"
|
||||||
import { Flag } from "../../flag/flag"
|
import { Flag } from "../../flag/flag"
|
||||||
|
import { bootstrap } from "../bootstrap"
|
||||||
|
|
||||||
export const ServeCommand = cmd({
|
export const ServeCommand = cmd({
|
||||||
command: "serve",
|
command: "serve",
|
||||||
|
|
@ -11,7 +12,8 @@ export const ServeCommand = cmd({
|
||||||
if (!Flag.OPENCODE_SERVER_PASSWORD) {
|
if (!Flag.OPENCODE_SERVER_PASSWORD) {
|
||||||
console.log("Warning: OPENCODE_SERVER_PASSWORD is not set; server is unsecured.")
|
console.log("Warning: OPENCODE_SERVER_PASSWORD is not set; server is unsecured.")
|
||||||
}
|
}
|
||||||
const opts = await resolveNetworkOptions(args)
|
|
||||||
|
const opts = await bootstrap(process.cwd(), () => resolveNetworkOptions(args))
|
||||||
const server = await Server.listen(opts)
|
const server = await Server.listen(opts)
|
||||||
console.log(`opencode server listening on http://${server.hostname}:${server.port}`)
|
console.log(`opencode server listening on http://${server.hostname}:${server.port}`)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import { withNetworkOptions, resolveNetworkOptions } from "../network"
|
||||||
import { Flag } from "../../flag/flag"
|
import { Flag } from "../../flag/flag"
|
||||||
import open from "open"
|
import open from "open"
|
||||||
import { networkInterfaces } from "os"
|
import { networkInterfaces } from "os"
|
||||||
|
import { bootstrap } from "../bootstrap"
|
||||||
|
|
||||||
function getNetworkIPs() {
|
function getNetworkIPs() {
|
||||||
const nets = networkInterfaces()
|
const nets = networkInterfaces()
|
||||||
|
|
@ -36,7 +37,7 @@ export const WebCommand = cmd({
|
||||||
if (!Flag.OPENCODE_SERVER_PASSWORD) {
|
if (!Flag.OPENCODE_SERVER_PASSWORD) {
|
||||||
UI.println(UI.Style.TEXT_WARNING_BOLD + "! OPENCODE_SERVER_PASSWORD is not set; server is unsecured.")
|
UI.println(UI.Style.TEXT_WARNING_BOLD + "! OPENCODE_SERVER_PASSWORD is not set; server is unsecured.")
|
||||||
}
|
}
|
||||||
const opts = await resolveNetworkOptions(args)
|
const opts = await bootstrap(process.cwd(), () => resolveNetworkOptions(args))
|
||||||
const server = await Server.listen(opts)
|
const server = await Server.listen(opts)
|
||||||
UI.empty()
|
UI.empty()
|
||||||
UI.println(UI.logo(" "))
|
UI.println(UI.logo(" "))
|
||||||
|
|
|
||||||
|
|
@ -7,23 +7,29 @@ import * as Vcs from "./vcs"
|
||||||
import { Bus } from "../bus"
|
import { Bus } from "../bus"
|
||||||
import { Command } from "../command"
|
import { Command } from "../command"
|
||||||
import { Instance } from "./instance"
|
import { Instance } from "./instance"
|
||||||
|
import { Plugin } from "../plugin"
|
||||||
import { Log } from "@/util"
|
import { Log } from "@/util"
|
||||||
import { FileWatcher } from "@/file/watcher"
|
import { FileWatcher } from "@/file/watcher"
|
||||||
import { ShareNext } from "@/share"
|
import { ShareNext } from "@/share"
|
||||||
import * as Effect from "effect/Effect"
|
import * as Effect from "effect/Effect"
|
||||||
|
import { Config } from "@/config"
|
||||||
|
|
||||||
export const InstanceBootstrap = Effect.gen(function* () {
|
export const InstanceBootstrap = Effect.gen(function* () {
|
||||||
Log.Default.info("bootstrapping", { directory: Instance.directory })
|
Log.Default.info("bootstrapping", { directory: Instance.directory })
|
||||||
yield* Effect.all(
|
yield* Effect.all(
|
||||||
[
|
[
|
||||||
LSP.Service,
|
Config.Service.use((i) => i.get()),
|
||||||
ShareNext.Service,
|
...[
|
||||||
Format.Service,
|
Plugin.Service,
|
||||||
File.Service,
|
LSP.Service,
|
||||||
FileWatcher.Service,
|
ShareNext.Service,
|
||||||
Vcs.Service,
|
Format.Service,
|
||||||
Snapshot.Service,
|
File.Service,
|
||||||
].map((s) => Effect.forkDetach(s.use((i) => i.init()))),
|
FileWatcher.Service,
|
||||||
|
Vcs.Service,
|
||||||
|
Snapshot.Service,
|
||||||
|
].map((s) => s.use((i) => i.init())),
|
||||||
|
].map((e) => Effect.forkDetach(e)),
|
||||||
).pipe(Effect.withSpan("InstanceBootstrap.init"))
|
).pipe(Effect.withSpan("InstanceBootstrap.init"))
|
||||||
|
|
||||||
yield* Bus.Service.use((svc) =>
|
yield* Bus.Service.use((svc) =>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue