feat(core): pass auth data to workspace (#22897)

This commit is contained in:
James Long
2026-04-16 16:30:11 -04:00
committed by GitHub
parent 9b77430d0d
commit a8d8a35cd3
4 changed files with 14 additions and 8 deletions

View File

@@ -56,6 +56,12 @@ export const layer = Layer.effect(
const decode = Schema.decodeUnknownOption(Info)
const all = Effect.fn("Auth.all")(function* () {
if (process.env.OPENCODE_AUTH_CONTENT) {
try {
return JSON.parse(process.env.OPENCODE_AUTH_CONTENT)
} catch (err) {}
}
const data = (yield* fsys.readJson(file).pipe(Effect.orElseSucceed(() => ({})))) as Record<string, unknown>
return Record.filterMap(data, (value) => Result.fromOption(decode(value), () => undefined))
})