Skip to content

Commit

Permalink
Change anonymize to use ENV
Browse files Browse the repository at this point in the history
  • Loading branch information
megastary committed Oct 11, 2024
1 parent c2d36a7 commit 5461561
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
5 changes: 4 additions & 1 deletion build-deps/defaults.env
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,7 @@ ESL_AIMS_ENABLED=false
ESL_AIMS_INTEGRATION_CRON=*/5 * * * *
ESL_AIMS_BASE_URL=
ESL_AIMS_STORE=
ESL_AIMS_VERIFY_TLS=true
ESL_AIMS_VERIFY_TLS=true
DASHBOARD_API_ENABLED=false
DASHBOARD_API_SECRET=trytochangemeifyoucan
DASHBOARD_API_ANONYMIZE_USERS=true
5 changes: 4 additions & 1 deletion example-dev.env
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,7 @@ ESL_AIMS_ENABLED=false
ESL_AIMS_INTEGRATION_CRON=*/5 * * * *
ESL_AIMS_BASE_URL=
ESL_AIMS_STORE=
ESL_AIMS_VERIFY_TLS=true
ESL_AIMS_VERIFY_TLS=true
DASHBOARD_API_ENABLED=false
DASHBOARD_API_SECRET=trytochangemeifyoucan
DASHBOARD_API_ANONYMIZE_USERS=true
14 changes: 8 additions & 6 deletions routes/api/latestOrders.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,14 @@ router.get('/', ensureAuthenticatedDashboardAPI, function (req, res) {
return {
order_date: order.order_date,
buyer_id: order.buyerInfo._id,
buyer_display_name: req.query.anonymize
? order.buyerInfo._id
: order.buyerInfo.displayName,
buyer_email: req.query.anonymize
? `${order.buyerInfo._id}@example.com`
: order.buyerInfo.email,
buyer_display_name:
process.env.DASHBOARD_API_ANONYMIZE_USERS.toLowerCase() === 'true'
? order.buyerInfo._id
: order.buyerInfo.displayName,
buyer_email:
process.env.DASHBOARD_API_ANONYMIZE_USERS.toLowerCase() === 'true'
? `${order.buyerInfo._id}@example.com`
: order.buyerInfo.email,
product_name: order.productInfo.displayName,
product_price: order.deliveryInfo.price
}
Expand Down

0 comments on commit 5461561

Please sign in to comment.