mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 12:47:13 +01:00
Added update-tracker script. Updated docker build.
This commit is contained in:
parent
bc75b622b5
commit
6cfe910ba9
3 changed files with 21 additions and 7 deletions
18
scripts/update-tracker.js
Normal file
18
scripts/update-tracker.js
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
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}"`),
|
||||
);
|
||||
|
||||
console.log(`Updated tracker endpoint with "${endPoint}"`);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue