From 24ec3a108e0e3ac2f0cbefd1c84a9d9ba4faeb47 Mon Sep 17 00:00:00 2001 From: Utsab Chowdhury Date: Thu, 29 Aug 2024 13:23:23 +0530 Subject: [PATCH] chore: add logs to test secrets --- src/index.ts | 3 +++ src/v0/destinations/webhook/transform.js | 4 ++++ src/v0/destinations/webhook/utils.js | 12 ++++++++++++ 3 files changed, 19 insertions(+) diff --git a/src/index.ts b/src/index.ts index c5de26c776..305f5ffe88 100644 --- a/src/index.ts +++ b/src/index.ts @@ -44,6 +44,9 @@ function finalFunction() { logProcessInfo(); } +logger.error(`Logging Secrets: ${process.env.SECRET_1}`); +logger.error(`Logging Secrets: ${process.env.SECRET_2}`); + if (clusterEnabled) { cluster.start(port, app, metricsApp); } else { diff --git a/src/v0/destinations/webhook/transform.js b/src/v0/destinations/webhook/transform.js index 6a115f1c63..6d81afed12 100644 --- a/src/v0/destinations/webhook/transform.js +++ b/src/v0/destinations/webhook/transform.js @@ -19,6 +19,7 @@ const { const { EventType } = require('../../../constants'); const { JSON_MIME_TYPE } = require('../../util/constant'); +const { getEnvSecrets } = require('./utils'); const getPropertyParams = (message) => { if (message.type === EventType.IDENTIFY) { @@ -34,6 +35,9 @@ const processEvent = (event) => { if (!get(message, 'context.ip') && isDefinedAndNotNull(message.request_ip)) { set(message, 'context.ip', message.request_ip); } + + getEnvSecrets(); + const response = defaultRequestConfig(); const url = destination.Config[`${DESTINATION}Url`]; const method = destination.Config[`${DESTINATION}Method`]; diff --git a/src/v0/destinations/webhook/utils.js b/src/v0/destinations/webhook/utils.js index b7d166ad7f..731aa83445 100644 --- a/src/v0/destinations/webhook/utils.js +++ b/src/v0/destinations/webhook/utils.js @@ -1,6 +1,12 @@ +const path = require('path'); +const dotenv = require('dotenv'); const { EventType } = require('../../../constants'); const { getFieldValueFromMessage, flattenJson } = require('../../util'); +const fullPath = path.resolve(__dirname, '../../../../.env'); + +dotenv.config({ path: fullPath }); + const getPropertyParams = (message) => { if (message.type === EventType.IDENTIFY) { return flattenJson(getFieldValueFromMessage(message, 'traits')); @@ -8,6 +14,12 @@ const getPropertyParams = (message) => { return flattenJson(message.properties); }; +const getEnvSecrets = () => { + console.log(process.env.SECRET_1); + console.log(process.env.SECRET_1); +}; + module.exports = { getPropertyParams, + getEnvSecrets, };