Add error if PLAUSIBLE_API_KEY is not present

pull/2293/head
Jérémy Rialland 2022-09-08 20:52:04 +02:00 committed by Jérémy Rialland
parent 28f56dedb6
commit 21b972a15d
1 changed files with 6 additions and 0 deletions

View File

@ -2,6 +2,12 @@ import 'dotenv/config.js'
import 'isomorphic-fetch'
const fetchApiStats = async (page, start, end, interval) => {
if (!process.env.PLAUSIBLE_API_KEY) {
throw new Error(
"Variables d'environnement manquantes : nous ne récupérons pas les statistiques d'usage"
)
}
const url =
'https://plausible.io/api/v1/stats/timeseries?' +
Object.entries({