Move browser bridge gRPC address to flag

This commit is contained in:
Joe Julian
2026-04-12 07:38:23 -07:00
parent 77e92a2368
commit 8117e3e8c1
4 changed files with 63 additions and 29 deletions
+4 -5
View File
@@ -29,7 +29,6 @@ const (
type Request struct {
Action string `json:"action"`
GRPCAddress string `json:"grpcAddress,omitempty"`
BearerToken string `json:"bearerToken,omitempty"`
URL string `json:"url,omitempty"`
EntryID string `json:"entryId,omitempty"`
@@ -139,9 +138,9 @@ func WriteResponse(w io.Writer, resp Response) error {
return err
}
func (r Request) Connection() (Connection, error) {
func (r Request) Connection(grpcAddr string) (Connection, error) {
return normalizeConnection(Connection{
GRPCAddress: strings.TrimSpace(r.GRPCAddress),
GRPCAddress: strings.TrimSpace(grpcAddr),
BearerToken: strings.TrimSpace(r.BearerToken),
})
}
@@ -158,8 +157,8 @@ func normalizeConnection(conn Connection) (Connection, error) {
return conn, nil
}
func HandleRequest(ctx context.Context, req Request, client Client) Response {
conn, err := req.Connection()
func HandleRequest(ctx context.Context, req Request, grpcAddr string, client Client) Response {
conn, err := req.Connection(grpcAddr)
if err != nil {
return Response{Success: false, Error: err.Error()}
}