Move browser bridge gRPC address to flag
This commit is contained in:
@@ -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()}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user