Skip to content

Commit

Permalink
Added support for calling Eventarc emulator (#1686)
Browse files Browse the repository at this point in the history
  • Loading branch information
apascal07 committed May 4, 2022
1 parent c21112e commit 2a76539
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/eventarc/eventarc-client-internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class EventarcApiClient {
}
const request: HttpRequestConfig = {
method: 'POST',
url: `${EVENTARC_API}/${channel}:publishEvents`,
url: `${this.getEventarcHost()}/${channel}:publishEvents`,
data: JSON.stringify({ events }),
};
return this.sendRequest(request);
Expand Down Expand Up @@ -153,4 +153,8 @@ export class EventarcApiClient {
const projectId = await this.getProjectId();
return `projects/${projectId}/locations/${location}/channels/${channelId}`;
}

private getEventarcHost(): string {
return process.env.CLOUD_EVENTARC_EMULATOR_HOST ?? EVENTARC_API;
}
}

0 comments on commit 2a76539

Please sign in to comment.