caelum0x 77324a7b50 feat(ration): split gateway into auth/tenant-registry/card-issuance/webhook-ingestion
Phase 2 service decomposition per docs/SCALE-EXPANSION.md section 1: extracts
internal/{airwallex,bridge,card,tenant,httpserver} out of the monolithic
gateway into four independently deployable gRPC services (each own go.mod,
Dockerfile, and tests), with gateway now a thin BFF that fans out through new
cardissuanceclient/webhookeventsclient gRPC clients. gateway.proto's external
surface is unchanged — agent/tui/cli still talk to gateway exactly as before.

Verified: all 10 go.work modules build and `go test ./...` passes across
every one, including the new gateway client packages against the live split
services (via `make build && make test`).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-19 12:25:41 +03:00

39 lines
1.0 KiB
Go

package main
import (
"context"
"flag"
"fmt"
"time"
ledgerpb "github.com/caelum0x/ration/pkg/pb/ledger"
"github.com/caelum0x/ration/services/gateway/internal/ledgerclient"
)
// runPing dials addr and makes one cheap, read-only RPC with a short
// timeout. Used by the chaos shell script's readiness-polling loop to
// detect "ledger-core has finished WAL recovery and is accepting RPCs
// again" after each restart, without assuming any tenant exists yet.
func runPing(args []string) error {
fs := flag.NewFlagSet("ping", flag.ContinueOnError)
addr := fs.String("addr", "", "ledger-core gRPC address, e.g. 127.0.0.1:7099")
if err := fs.Parse(args); err != nil {
return err
}
if *addr == "" {
return fmt.Errorf("--addr is required")
}
client, err := ledgerclient.Dial(*addr)
if err != nil {
return err
}
defer client.Close()
client.Timeout = 2 * time.Second
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
defer cancel()
_, err = client.ListTenants(ctx, &ledgerpb.ListTenantsRequest{PageSize: 1})
return err
}