mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-22 01:46:58 +01:00
20 lines
467 B
JavaScript
20 lines
467 B
JavaScript
/* eslint-disable no-console */
|
|
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/script.js');
|
|
|
|
const tracker = fs.readFileSync(file);
|
|
|
|
fs.writeFileSync(
|
|
path.resolve(file),
|
|
tracker.toString().replace(/"\/api\/send"/g, `"${endPoint}"`),
|
|
);
|
|
|
|
console.log(`Updated tracker endpoint: ${endPoint}.`);
|
|
}
|