mirror of
https://github.com/hanzoai/gateway.git
synced 2026-10-30 15:04:44 +00:00
* refactor(gateway): quarantine the Lura/KrakenD engine behind `legacy` build tag (#29) Task #29 — own the framework deps. The gateway module path is already hanzoai-owned (github.com/hanzoai/gateway/v2), but the default build still pulled the upstream github.com/luraproject/lura + github.com/krakend/* graph (105 packages) into `go build ./...` and the shipping ghcr.io/hanzoai/gateway image. This decomplects the KrakenD engine from the default surface. Decomplect (values, not places): the pure host/path reverse-proxy routing table split out of router_engine.go into routes.go (stdlib + gin + yaml, ZERO Lura/KrakenD). The Lura gin-engine builder moved to krakend_engine.go behind `//go:build legacy`. Every remaining file that imports lura/krakend is gated behind the same tag so the two builds are orthogonal: default (go build ./...) — KrakenD-free, ships the HIP-0110 ZAP relay + pure router. 0 krakend pkgs. legacy (go build -tags legacy) — full Lura/KrakenD engine, kept compilable for the Phase-A→C rollout safety window. 105 krakend pkgs. Gated files (all lura/krakend importers): backend_factory, base_ha_backend, base_network_backend, encoding, executor, handler_factory, plugin, proxy_factory, rebrand, sd, zap_backend, zaphttp_listener + their tests, the tests/ Lura integration harness, and cmd/gateway-integration. The default routing/auth/mount/ZAP-relay surface (routes.go, mount.go, build_app.go, gate.go, auth_middleware.go, ...) already had zero krakend imports. Proof: go build ./... -> exit 0 go list -deps ./cmd/gateway | krakend -> 0 (KrakenD-free default/image) go build -tags legacy ./... -> exit 0 go list -tags legacy -deps | krakend -> 105 (quarantined behind the tag) go vet ./... -> exit 0 go test ./... -> all packages ok * docs(gateway): document the Lura/KrakenD fork-ownership boundary + legacy gate (#29) --------- Co-authored-by: Hanzo Dev <[email protected]>
44 lines
614 B
Go
44 lines
614 B
Go
//go:build legacy
|
|
// +build legacy
|
|
|
|
package main
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/hanzoai/gateway/v2/tests"
|
|
)
|
|
|
|
func main() {
|
|
flag.Parse()
|
|
|
|
runner, tcs, err := tests.NewIntegration(nil, nil, nil)
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
os.Exit(1)
|
|
return
|
|
}
|
|
|
|
errors := 0
|
|
|
|
for _, tc := range tcs {
|
|
if err := runner.Check(tc); err != nil {
|
|
errors++
|
|
fmt.Printf("%s: %s\n", tc.Name, err.Error())
|
|
continue
|
|
}
|
|
fmt.Printf("%s: ok\n", tc.Name)
|
|
}
|
|
fmt.Printf("%d test completed\n", len(tcs))
|
|
runner.Close()
|
|
|
|
if errors == 0 {
|
|
return
|
|
}
|
|
|
|
fmt.Printf("%d test failed\n", errors)
|
|
os.Exit(1)
|
|
}
|