2022-08-09 22:09:41 +02:00
|
|
|
require('dotenv').config();
|
|
|
|
const fs = require('fs');
|
|
|
|
const path = require('path');
|
|
|
|
|
|
|
|
const endPoint = process.env.COLLECT_API_ENDPOINT;
|
|
|
|
|
|
|
|
if (endPoint) {
|
|
|
|
const file = path.resolve(__dirname, '../public/umami.js');
|
|
|
|
|
|
|
|
const tracker = fs.readFileSync(file);
|
|
|
|
|
|
|
|
fs.writeFileSync(
|
|
|
|
path.resolve(file),
|
|
|
|
tracker.toString().replace(/"\/api\/collect"/g, `"${endPoint}"`),
|
|
|
|
);
|
|
|
|
|
2022-08-09 22:36:24 +02:00
|
|
|
console.log(`Updated tracker endpoint: ${endPoint}.`);
|
2022-08-09 22:09:41 +02:00
|
|
|
}
|