Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capture Airnode gateway URLs programmatically #1911

Closed
dcroote opened this issue Nov 9, 2023 · 3 comments
Closed

Capture Airnode gateway URLs programmatically #1911

dcroote opened this issue Nov 9, 2023 · 3 comments
Assignees
Milestone

Comments

@dcroote
Copy link
Contributor

dcroote commented Nov 9, 2023

Gateway URLs are printed to the console at the end of a cloud deployment as described in the docs here. The URLs aren't easily retrievable otherwise.

To facilitate #1858, #1904, and #1786 (because airnode-client is used in gateway E2E tests) there should be a helper function to capture these URLs.

@dcroote dcroote added this to the 0.14.0 milestone Nov 9, 2023
@dcroote dcroote self-assigned this Nov 9, 2023
@bbenligiray
Copy link
Member

I suppose it wouldn't be easy to mock a heartbeat server for this

@dcroote
Copy link
Contributor Author

dcroote commented Nov 28, 2023

The heartbeat is an interesting thought. It turns out it was pretty easy to do in #1904 with a simple regex against the deployment command output logged to the console:

export const extractGatewayUrls = (consoleOutput: string) => {
const httpRegex = /HTTP gateway URL: (https:\/\/[^\s]+)/;
const httpMatches = consoleOutput.match(httpRegex);
if (!httpMatches) {
throw new Error('Could not extract the HTTP gateway URL from console output');
}
const signedRegex = /HTTP signed data gateway URL: (https:\/\/[^\s]+)/;
const signedMatches = consoleOutput.match(signedRegex);
if (!signedMatches) {
throw new Error('Could not extract the HTTP signed data gateway URL from console output');
}
return {
httpGatewayUrl: httpMatches[1],
signedHttpGatewayUrl: signedMatches[1],
};
};

@dcroote
Copy link
Contributor Author

dcroote commented Jan 2, 2024

Closing as the regexs work well

@dcroote dcroote closed this as completed Jan 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants