How to use the @instana/core.secrets.matchers function in @instana/core

To help you get started, we’ve selected a few @instana/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github instana / nodejs-sensor / packages / collector / src / announceCycle / unannounced.js View on Github external
if (Array.isArray(response.extraHeaders)) {
      tracing.setExtraHttpHeadersToCapture(
        response.extraHeaders.map(function(s) {
          // Node.js HTTP API turns all incoming HTTP headers into lowercase.
          return s.toLowerCase();
        })
      );
    }

    if (response.secrets) {
      if (!(typeof response.secrets.matcher === 'string')) {
        logger.warn(
          'Received invalid secrets configuration from agent, attribute matcher is not a string: $s',
          response.secrets.matcher
        );
      } else if (Object.keys(secrets.matchers).indexOf(response.secrets.matcher) < 0) {
        logger.warn(
          'Received invalid secrets configuration from agent, matcher is not supported: $s',
          response.secrets.matcher
        );
      } else if (!Array.isArray(response.secrets.list)) {
        logger.warn(
          'Received invalid secrets configuration from agent, attribute list is not an array: $s',
          response.secrets.list
        );
      } else {
        secrets.setMatcher(response.secrets.matcher, response.secrets.list);
      }
    }

    ctx.transitionTo('announced');
  });