MCPcopy Index your code
hub / github.com/api3dao/airnode / parseConfigWithSecrets

Function parseConfigWithSecrets

packages/airnode-validator/src/api/api.ts:16–31  ·  view source on GitHub ↗
(config: unknown, secrets: unknown)

Source from the content-addressed store, hash-verified

14 * @returns `{success: true, data: <interpolated config>}` if successful, `{success: false, error: <error>}` otherwise
15 */
16export function parseConfigWithSecrets(config: unknown, secrets: unknown): ValidationResult<Config> {
17 const parsedSecrets = parseSecrets(secrets);
18 if (!parsedSecrets.success) return parsedSecrets;
19
20 const interpolateConfigRes = goSync(() =>
21 interpolateSecretsIntoConfig(config, parsedSecrets.data, { allowBlankSecretValue: false, validateSecretName: true })
22 );
23 if (!interpolateConfigRes.success) {
24 return {
25 success: false,
26 error: new Error('Secrets interpolation failed. Caused by: ' + interpolateConfigRes.error.message),
27 };
28 }
29
30 return parseConfig(interpolateConfigRes.data);
31}
32
33/**
34 * @param config a JSON object representation of config.json

Callers 4

loadConfigFunction · 0.90
validateConfigurationFunction · 0.90
api.test.tsFile · 0.90

Calls 2

parseSecretsFunction · 0.85
parseConfigFunction · 0.85

Tested by

no test coverage detected