Skip to content

Commit

Permalink
chore: add logs to test secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
utsabc committed Aug 29, 2024
1 parent df66241 commit 24ec3a1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions src/v0/destinations/webhook/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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`];
Expand Down
12 changes: 12 additions & 0 deletions src/v0/destinations/webhook/utils.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
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'));
}
return flattenJson(message.properties);
};

const getEnvSecrets = () => {
console.log(process.env.SECRET_1);

Check warning on line 18 in src/v0/destinations/webhook/utils.js

View workflow job for this annotation

GitHub Actions / Check for formatting & lint errors

Unexpected console statement

Check warning on line 18 in src/v0/destinations/webhook/utils.js

View workflow job for this annotation

GitHub Actions / Code Coverage

Unexpected console statement
console.log(process.env.SECRET_1);

Check warning on line 19 in src/v0/destinations/webhook/utils.js

View workflow job for this annotation

GitHub Actions / Check for formatting & lint errors

Unexpected console statement

Check warning on line 19 in src/v0/destinations/webhook/utils.js

View workflow job for this annotation

GitHub Actions / Code Coverage

Unexpected console statement
};

module.exports = {
getPropertyParams,
getEnvSecrets,
};

0 comments on commit 24ec3a1

Please sign in to comment.