Compare commits
2
Commits
0aaf4116f1
...
b6767e247c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b6767e247c | ||
|
|
6cf5c3e5a9 |
@@ -67,10 +67,10 @@ jobs:
|
|||||||
|
|
||||||
- name: Registry login
|
- name: Registry login
|
||||||
run: |
|
run: |
|
||||||
echo "${FORGEJO_PAT}" | docker login "${REGISTRY}" \
|
echo "${GITHUB_TOKEN}" | docker login "${REGISTRY}" \
|
||||||
--username rock --password-stdin
|
--username rock --password-stdin
|
||||||
env:
|
env:
|
||||||
FORGEJO_PAT: ${{ secrets.FORGEJO_RIOTPIAO_PAT }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
+3
-3
@@ -9,9 +9,9 @@ import (
|
|||||||
"os/signal"
|
"os/signal"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/Riotpiaole/homelab-frontend/internal/config"
|
"forgejo.riotpiao.com/rock/homelab-frontend/internal/config"
|
||||||
"github.com/Riotpiaole/homelab-frontend/internal/proxy"
|
"forgejo.riotpiao.com/rock/homelab-frontend/internal/proxy"
|
||||||
"github.com/Riotpiaole/homelab-frontend/internal/server"
|
"forgejo.riotpiao.com/rock/homelab-frontend/internal/server"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"go.temporal.io/sdk/client"
|
"go.temporal.io/sdk/client"
|
||||||
"github.com/Riotpiaole/homelab-frontend/internal/workflow"
|
"forgejo.riotpiao.com/rock/homelab-frontend/internal/workflow"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
"go.temporal.io/sdk/client"
|
"go.temporal.io/sdk/client"
|
||||||
"go.temporal.io/sdk/worker"
|
"go.temporal.io/sdk/worker"
|
||||||
"github.com/Riotpiaole/homelab-frontend/internal/workflow"
|
"forgejo.riotpiao.com/rock/homelab-frontend/internal/workflow"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
module github.com/Riotpiaole/homelab-frontend
|
module forgejo.riotpiao.com/rock/homelab-frontend
|
||||||
|
|
||||||
go 1.25.4
|
go 1.25.4
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package config_test
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/Riotpiaole/homelab-frontend/internal/config"
|
"forgejo.riotpiao.com/rock/homelab-frontend/internal/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestLoadRoutesMissingAuthRequired tests that the auth-required flag is not a silent default:
|
// TestLoadRoutesMissingAuthRequired tests that the auth-required flag is not a silent default:
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Riotpiaole/homelab-frontend/internal/config"
|
"forgejo.riotpiao.com/rock/homelab-frontend/internal/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestLoadRoutesValidConfig tests that a valid configuration loads correctly.
|
// TestLoadRoutesValidConfig tests that a valid configuration loads correctly.
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Riotpiaole/homelab-frontend/internal/config"
|
"forgejo.riotpiao.com/rock/homelab-frontend/internal/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestLoadIntegration tests the full Load function with CONFIG_PATH env var
|
// TestLoadIntegration tests the full Load function with CONFIG_PATH env var
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Riotpiaole/homelab-frontend/internal/config"
|
"forgejo.riotpiao.com/rock/homelab-frontend/internal/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestBodyBasedDispatch verifies that /v1/chat/completions routes based on model field.
|
// TestBodyBasedDispatch verifies that /v1/chat/completions routes based on model field.
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Riotpiaole/homelab-frontend/internal/config"
|
"forgejo.riotpiao.com/rock/homelab-frontend/internal/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestBodySizeCapExact verifies that a body exactly at the cap is accepted.
|
// TestBodySizeCapExact verifies that a body exactly at the cap is accepted.
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/Riotpiaole/homelab-frontend/internal/config"
|
"forgejo.riotpiao.com/rock/homelab-frontend/internal/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestEmbeddingsPassthroughNoRewrite verifies /v1/embeddings is not rewritten
|
// TestEmbeddingsPassthroughNoRewrite verifies /v1/embeddings is not rewritten
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Riotpiaole/homelab-frontend/internal/config"
|
"forgejo.riotpiao.com/rock/homelab-frontend/internal/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestHeaderHygiene verifies that headers are properly filtered and forwarded.
|
// TestHeaderHygiene verifies that headers are properly filtered and forwarded.
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Riotpiaole/homelab-frontend/internal/config"
|
"forgejo.riotpiao.com/rock/homelab-frontend/internal/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ModelListResponse represents the response shape for GET /v1/models
|
// ModelListResponse represents the response shape for GET /v1/models
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Riotpiaole/homelab-frontend/internal/config"
|
"forgejo.riotpiao.com/rock/homelab-frontend/internal/config"
|
||||||
"github.com/Riotpiaole/homelab-frontend/internal/logging"
|
"forgejo.riotpiao.com/rock/homelab-frontend/internal/logging"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Handler is a reverse proxy that routes requests to configured upstreams.
|
// Handler is a reverse proxy that routes requests to configured upstreams.
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Riotpiaole/homelab-frontend/internal/config"
|
"forgejo.riotpiao.com/rock/homelab-frontend/internal/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestProxyBasic(t *testing.T) {
|
func TestProxyBasic(t *testing.T) {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"github.com/Riotpiaole/homelab-frontend/internal/config"
|
"forgejo.riotpiao.com/rock/homelab-frontend/internal/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RouteRequest determines which upstream should handle the request.
|
// RouteRequest determines which upstream should handle the request.
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Riotpiaole/homelab-frontend/internal/config"
|
"forgejo.riotpiao.com/rock/homelab-frontend/internal/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestSSEUnbuffered verifies that SSE events stream to the client without buffering.
|
// TestSSEUnbuffered verifies that SSE events stream to the client without buffering.
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Riotpiaole/homelab-frontend/internal/config"
|
"forgejo.riotpiao.com/rock/homelab-frontend/internal/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestConnectTimeout verifies that connections fail at the configured timeout.
|
// TestConnectTimeout verifies that connections fail at the configured timeout.
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Riotpiaole/homelab-frontend/internal/config"
|
"forgejo.riotpiao.com/rock/homelab-frontend/internal/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
// OpenAI-style tool definition
|
// OpenAI-style tool definition
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/Riotpiaole/homelab-frontend/internal/config"
|
"forgejo.riotpiao.com/rock/homelab-frontend/internal/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RFC 9457 Problem Details
|
// RFC 9457 Problem Details
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Riotpiaole/homelab-frontend/internal/server"
|
"forgejo.riotpiao.com/rock/homelab-frontend/internal/server"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestHealthEndpoints verifies health endpoint behavior.
|
// TestHealthEndpoints verifies health endpoint behavior.
|
||||||
|
|||||||
@@ -21,11 +21,17 @@ type Server struct {
|
|||||||
func New(listenAddr string, shutdownTimeout time.Duration, handler http.Handler) *Server {
|
func New(listenAddr string, shutdownTimeout time.Duration, handler http.Handler) *Server {
|
||||||
return &Server{
|
return &Server{
|
||||||
httpServer: &http.Server{
|
httpServer: &http.Server{
|
||||||
Addr: listenAddr,
|
Addr: listenAddr,
|
||||||
Handler: handler,
|
Handler: handler,
|
||||||
ReadTimeout: 15 * time.Second,
|
// ReadHeaderTimeout (not ReadTimeout) and a long WriteTimeout: both
|
||||||
WriteTimeout: 15 * time.Second,
|
// ReadTimeout and WriteTimeout are absolute deadlines covering the
|
||||||
IdleTimeout: 60 * time.Second,
|
// whole request/response body, not inactivity timeouts -- a 15s
|
||||||
|
// WriteTimeout here was killing in-progress LLM SSE streams (proxy.go's
|
||||||
|
// outbound transport deliberately avoids this same mistake). Mirrors
|
||||||
|
// the edge nginx Ingress's proxy-read/send-timeout of 3600s.
|
||||||
|
ReadHeaderTimeout: 15 * time.Second,
|
||||||
|
WriteTimeout: 1 * time.Hour,
|
||||||
|
IdleTimeout: 60 * time.Second,
|
||||||
},
|
},
|
||||||
shutdownTimeout: shutdownTimeout,
|
shutdownTimeout: shutdownTimeout,
|
||||||
healthChecker: NewHealthChecker(false, false),
|
healthChecker: NewHealthChecker(false, false),
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Riotpiaole/homelab-frontend/internal/server"
|
"forgejo.riotpiao.com/rock/homelab-frontend/internal/server"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestGracefulShutdown verifies that:
|
// TestGracefulShutdown verifies that:
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Riotpiaole/homelab-frontend/internal/config"
|
"forgejo.riotpiao.com/rock/homelab-frontend/internal/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
// startForTest binds the stub on an ephemeral port so the suite does not fight
|
// startForTest binds the stub on an ephemeral port so the suite does not fight
|
||||||
|
|||||||
Reference in New Issue
Block a user