MCPcopy Create free account
hub / github.com/api3dao/airnode / main

Function main

packages/airnode-examples/src/scripts/run-airnode-locally.ts:12–41  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10
11// eslint-disable-next-line require-await
12const main = async () => {
13 const integrationInfo = readIntegrationInfo();
14 if (integrationInfo.airnodeType !== 'local') {
15 cliPrint.error('You only need to run this script if you want to run Airnode locally!');
16 return;
17 }
18
19 // Check if we're executing in Github CI - if we are, run the airnode-client development image.
20 // If not and a command line arg was passed, use the command-line provided image name (developer convenience).
21 // If neither of the first two, use the version from package.json
22 const specificImage = process.argv.slice(2);
23 const packageVersion = readPackageVersion();
24 let imageName: string;
25 if (process.env.CI) {
26 imageName = `api3/airnode-client-dev:${process.env.GITHUB_SHA}`;
27 } else if (specificImage.length === 1) {
28 imageName = specificImage[0];
29 } else {
30 imageName = `api3/airnode-client:${packageVersion}`;
31 }
32
33 const integrationPath = join(__dirname, '../../integrations', integrationInfo.integration);
34 if (isMacOrWindows()) {
35 runShellCommand(
36 `docker run --rm -v ${integrationPath}:/app/config --publish 3000:3000 --name airnode ${imageName}`
37 );
38 } else {
39 runShellCommand(`docker run --rm -v ${integrationPath}:/app/config --network host --name airnode ${imageName}`);
40 }
41};
42
43runAndHandleErrors(main);

Callers

nothing calls this directly

Calls 4

readIntegrationInfoFunction · 0.85
readPackageVersionFunction · 0.85
isMacOrWindowsFunction · 0.85
runShellCommandFunction · 0.85

Tested by

no test coverage detected