refactor(cli): single password config with legacy fallback

This commit is contained in:
Dax Raad 2026-07-03 13:41:15 -04:00
commit 08293e74a0
4 changed files with 13 additions and 11 deletions

View file

@ -19,7 +19,7 @@ export default Runtime.handler(Commands, (input) =>
return yield* Effect.fail(new Error("--server and --standalone cannot be combined"))
const transport = yield* Effect.gen(function* () {
if (server !== undefined) {
const password = Option.getOrUndefined(yield* Env.password)
const password = yield* Env.password
const explicit = {
url: server,
headers: password

View file

@ -27,10 +27,13 @@ export default Runtime.handler(
if (input.service) yield* Effect.sync(() => process.chdir(Global.Path.home))
return yield* Effect.scoped(
Effect.gen(function* () {
const standalonePassword = Option.getOrUndefined(yield* Env.serverPassword)
const standalonePassword = yield* Env.password
// Keep the lease credential out of the environment inherited by any
// process this server spawns.
if (input.stdio) delete process.env.OPENCODE_SERVER_PASSWORD
if (input.stdio) {
delete process.env.OPENCODE_PASSWORD
delete process.env.OPENCODE_SERVER_PASSWORD
}
const config = input.service ? yield* ServiceConfig.read() : {}
const password = input.service
? yield* ServiceConfig.password()