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

Function main

packages/airnode-examples/src/scripts/create-airnode-secrets.ts:5–27  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3import { isMacOrWindows, readIntegrationInfo, runAndHandleErrors } from '../';
4
5const main = async () => {
6 const integrationInfo = readIntegrationInfo();
7 // Import the "create-secrets" file from the chosen integration. See the respective "create-secrets.ts" file for
8 // details.
9 const createSecrets = await import(`../../integrations/${integrationInfo.integration}/create-secrets.ts`);
10 await createSecrets.default();
11
12 // Windows and MacOS docker users need to change the provider URL if running airnode client on localhost network. See:
13 // https://stackoverflow.com/a/24326540 for more information.
14 if (integrationInfo.network === 'localhost' && integrationInfo.airnodeType === 'local' && isMacOrWindows()) {
15 const secretsPath = join(__dirname, `../../integrations/`, integrationInfo.integration, `secrets.env`);
16 const rawSecrets = readFileSync(secretsPath).toString();
17 writeFileSync(
18 secretsPath,
19 rawSecrets
20 .replace('PROVIDER_URL=http://127.0.0.1:8545/', 'PROVIDER_URL=http://host.docker.internal:8545')
21 .replace(
22 'CROSS_CHAIN_PROVIDER_URL=http://127.0.0.1:8545/',
23 'CROSS_CHAIN_PROVIDER_URL=http://host.docker.internal:8545'
24 )
25 );
26 }
27};
28
29runAndHandleErrors(main);

Callers

nothing calls this directly

Calls 2

readIntegrationInfoFunction · 0.85
isMacOrWindowsFunction · 0.85

Tested by

no test coverage detected