frontend: deep-link via ?instance=; client/frontend default to :9090; Makefile help; v1.1.0

- cmd/frontend/web: honour ?instance=<hostname> query parameter on the
  initial scope hydration so /view/?instance=lb-ams opens the dashboard
  scoped to that maglevd. The cookie is updated on consumption; an
  unknown name still falls back to the first server via App.tsx.

- cmd/client, cmd/frontend: --server now accepts bare hostnames. A new
  internal/netutil.EnsurePort canonicalises addresses by appending
  :9090 when no port is given, with bracketing for bare IPv6 literals.
  Unit test covers the IPv4/IPv6/bracketed/already-ported permutations.

- Makefile: new self-documenting `help` target as the default rule;
  every user-facing target now carries a `## ` description that the
  awk-based help auto-extracts. fixstyle-web skips with a friendly
  message when prettier isn't installed instead of failing on npx.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-01 10:27:16 +02:00
parent 9a3c5c5dc0
commit fb61e72e06
9 changed files with 142 additions and 29 deletions
+10 -2
View File
@@ -14,8 +14,15 @@ import (
buildinfo "git.ipng.ch/ipng/vpp-maglev/cmd"
"git.ipng.ch/ipng/vpp-maglev/internal/grpcapi"
"git.ipng.ch/ipng/vpp-maglev/internal/netutil"
)
// defaultGRPCPort is the maglevd gRPC port (mirrors the server's
// -grpc-addr default in cmd/server/main.go). Used when -server is given
// without an explicit ":<port>" so operators can type "--server chbtl2"
// instead of "--server chbtl2:9090".
const defaultGRPCPort = "9090"
func main() {
if err := run(); err != nil {
fmt.Fprintf(os.Stderr, "%s\n", formatError(err))
@@ -49,10 +56,11 @@ func run() error {
}
})
conn, err := grpc.NewClient(*serverAddr,
addr := netutil.EnsurePort(*serverAddr, defaultGRPCPort)
conn, err := grpc.NewClient(addr,
grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
return fmt.Errorf("connect %s: %w", *serverAddr, err)
return fmt.Errorf("connect %s: %w", addr, err)
}
defer func() { _ = conn.Close() }()