2022-11-04 05:33:37 +01:00
|
|
|
/* eslint-disable no-console */
|
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) {
|
2023-04-18 16:29:30 +02:00
|
|
|
const file = path.resolve(__dirname, '../public/script.js');
|
2022-08-09 22:09:41 +02:00
|
|
|
|
|
|
|
const tracker = fs.readFileSync(file);
|
|
|
|
|
2024-03-06 02:48:26 +01:00
|
|
|
fs.writeFileSync(path.resolve(file), tracker.toString().replace(/\/api\/send/g, endPoint));
|
2022-08-09 22:09:41 +02:00
|
|
|
|
2022-08-09 22:36:24 +02:00
|
|
|
console.log(`Updated tracker endpoint: ${endPoint}.`);
|
2022-08-09 22:09:41 +02:00
|
|
|
}
|