introduce separate weave-proxy service which holds the API key
This prevents opencode from having access to the `WEAVE_API_KEY` enviroment variable.
This commit is contained in:
@@ -22,9 +22,10 @@ A first run from a clean checkout.
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
services:
|
services:
|
||||||
opencode:
|
weave-proxy:
|
||||||
environment:
|
environment:
|
||||||
WEAVE_API_KEY: "your-key-here"
|
WEAVE_API_KEY: "your-key-here"
|
||||||
|
opencode:
|
||||||
volumes:
|
volumes:
|
||||||
- /path/to/your/repo:/workspace/repo
|
- /path/to/your/repo:/workspace/repo
|
||||||
```
|
```
|
||||||
@@ -121,8 +122,7 @@ name** from that stack's compose and `<port>` is the container's *internal* port
|
|||||||
- **`model` / `small_model`** — default model and the model used for lighter
|
- **`model` / `small_model`** — default model and the model used for lighter
|
||||||
tasks. Both default to `weave/glm-5.2`.
|
tasks. Both default to `weave/glm-5.2`.
|
||||||
- **`provider.weave`** — the weave provider, using the
|
- **`provider.weave`** — the weave provider, using the
|
||||||
`@ai-sdk/openai-compatible` adapter against `https://weave.redpencil.io/v1`
|
`@ai-sdk/openai-compatible` adapter against `http://weave-proxy/v1`.
|
||||||
with the key from `WEAVE_API_KEY`.
|
|
||||||
- **`provider.weave.models`** — the models offered in `/models`.
|
- **`provider.weave.models`** — the models offered in `/models`.
|
||||||
- **`lsp`** — language servers baked into the image:
|
- **`lsp`** — language servers baked into the image:
|
||||||
`typescript-language-server` for TS/JS and `pyright` for Python.
|
`typescript-language-server` for TS/JS and `pyright` for Python.
|
||||||
|
|||||||
11
config/nginx/templates/default.conf.template
Normal file
11
config/nginx/templates/default.conf.template
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
location / {
|
||||||
|
proxy_pass https://weave.redpencil.io;
|
||||||
|
proxy_ssl_server_name on;
|
||||||
|
proxy_set_header Host weave.redpencil.io;
|
||||||
|
proxy_set_header Authorization "Bearer ${WEAVE_API_KEY}";
|
||||||
|
proxy_buffering off; # SSE streaming
|
||||||
|
proxy_read_timeout 600s; # match opencode's 5-min defaults
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -34,8 +34,8 @@
|
|||||||
"weave": {
|
"weave": {
|
||||||
"npm": "@ai-sdk/openai-compatible",
|
"npm": "@ai-sdk/openai-compatible",
|
||||||
"options": {
|
"options": {
|
||||||
"baseURL": "https://weave.redpencil.io/v1",
|
"baseURL": "http://weave-proxy/v1",
|
||||||
"apiKey": "{env:WEAVE_API_KEY}"
|
"apiKey": "not-needed"
|
||||||
},
|
},
|
||||||
"models": {
|
"models": {
|
||||||
"kimi-K2.7-code": {
|
"kimi-K2.7-code": {
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
services:
|
services:
|
||||||
|
weave-proxy:
|
||||||
|
image: nginx:1.31.7-alpine
|
||||||
|
volumes:
|
||||||
|
- ./config/nginx/templates:/etc/nginx/templates:ro
|
||||||
opencode:
|
opencode:
|
||||||
image: redpencil/opencode:0.0.2
|
image: redpencil/opencode:0.0.2
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
Reference in New Issue
Block a user