Skip to content

Commit

Permalink
fix cloudflare analytics auth
Browse files Browse the repository at this point in the history
  • Loading branch information
InventivetalentDev committed Oct 10, 2023
1 parent 548bff5 commit 1f306f1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions routes/metrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = function (express, config) {
if (m.length < 2) {
m = "0" + m;
}
let d = `${ startTime.getDate() }`;
let d = `${startTime.getDate()}`;
if (d.length < 2) {
d = "0" + d;
}
Expand Down Expand Up @@ -43,9 +43,8 @@ module.exports = function (express, config) {
variables: {}
}, {
headers: {
"X-Auth-Email": config.cloudflare.email,
"X-Auth-Key": config.cloudflare.key,
"Content-Type": "application/json"
"Content-Type": "application/json",
"Authorization": "Bearer " + config.cloudflare.key
}
}).then(response => {
let data = [];
Expand All @@ -65,6 +64,9 @@ module.exports = function (express, config) {
res.json(data);
}).catch(err => {
console.log(err);
if (err.response && err.response.data) {
console.log(err.response.data);
}
res.status(500);
});
});
Expand Down

0 comments on commit 1f306f1

Please sign in to comment.