Commit ff4446a
authored
feat(server): expose opencode server proxy url env (#351)
Fixes #321
## Summary
- expose OPENCODE_SERVER_BASE_URL in the spawned OpenCode workspace
environment
- point it at the current workspace's stable CodeNomad proxy URL
- propagate the new variable through WSL launches alongside the existing
auth env vars
## Why
Tools and plugins already receive the auth credentials needed to call
the current workspace instance, but they still need an extra lookup to
discover the correct URL.
The proxy URL is already known before runtime startup, so exposing it
directly removes that lookup without changing OpenCode's port selection
flow.
## What Changed
- packages/server/src/workspaces/opencode-auth.ts: added the
OPENCODE_SERVER_BASE_URL env var constant
- packages/server/src/workspaces/manager.ts: injects
OPENCODE_SERVER_BASE_URL into the workspace runtime environment using
CODENOMAD_BASE_URL + proxyPath
- packages/server/src/workspaces/__tests__/spawn.test.ts: updates WSL
env propagation coverage for the new variable
## Validation
- npx tsx --test
"packages/server/src/workspaces/__tests__/spawn.test.ts"1 parent 0ba1371 commit ff4446a
3 files changed
Lines changed: 9 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
59 | 60 | | |
60 | 61 | | |
61 | | - | |
| 62 | + | |
62 | 63 | | |
63 | 64 | | |
64 | 65 | | |
| |||
75 | 76 | | |
76 | 77 | | |
77 | 78 | | |
78 | | - | |
| 79 | + | |
79 | 80 | | |
80 | 81 | | |
81 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
122 | 123 | | |
123 | 124 | | |
124 | 125 | | |
| 126 | + | |
| 127 | + | |
125 | 128 | | |
126 | 129 | | |
127 | 130 | | |
| |||
137 | 140 | | |
138 | 141 | | |
139 | 142 | | |
140 | | - | |
| 143 | + | |
141 | 144 | | |
| 145 | + | |
142 | 146 | | |
143 | 147 | | |
144 | 148 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
0 commit comments