umami/scripts/update-tracker.js
Brian Cao 9979672de5
Feat/um 202 event data new (#1841)
* Add event_data base.

* Add url_path.

* Add eventData back.

* Finish event_data relational.

* resolve comments.
2023-03-23 14:01:15 -07:00

20 lines
466 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/umami.js');
const tracker = fs.readFileSync(file);
fs.writeFileSync(
path.resolve(file),
tracker.toString().replace(/"\/api\/send"/g, `"${endPoint}"`),
);
console.log(`Updated tracker endpoint: ${endPoint}.`);
}