diff --git a/build-deps/defaults.env b/build-deps/defaults.env index 4e169e3..b72b117 100644 --- a/build-deps/defaults.env +++ b/build-deps/defaults.env @@ -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 \ No newline at end of file +ESL_AIMS_VERIFY_TLS=true +DASHBOARD_API_ENABLED=false +DASHBOARD_API_SECRET=trytochangemeifyoucan +DASHBOARD_API_ANONYMIZE_USERS=true \ No newline at end of file diff --git a/example-dev.env b/example-dev.env index 16e22d0..bf070c0 100644 --- a/example-dev.env +++ b/example-dev.env @@ -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 \ No newline at end of file +ESL_AIMS_VERIFY_TLS=true +DASHBOARD_API_ENABLED=false +DASHBOARD_API_SECRET=trytochangemeifyoucan +DASHBOARD_API_ANONYMIZE_USERS=true \ No newline at end of file diff --git a/routes/api/latestOrders.js b/routes/api/latestOrders.js index deb5e14..37665d6 100644 --- a/routes/api/latestOrders.js +++ b/routes/api/latestOrders.js @@ -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 }