mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-19 03:42:23 -06:00
fix: adjusts in telemetry
This commit is contained in:
@@ -10,14 +10,23 @@ export interface TelemetryData {
|
||||
}
|
||||
|
||||
export const sendTelemetry = async (route: string): Promise<void> => {
|
||||
const enabled = process.env.TELEMETRY_ENABLED === undefined || process.env.TELEMETRY_ENABLED === 'true';
|
||||
|
||||
console.log('Telemetry enabled:', enabled);
|
||||
if (!enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
const telemetry: TelemetryData = {
|
||||
route,
|
||||
apiVersion: `${packageJson.version}`,
|
||||
timestamp: new Date(),
|
||||
};
|
||||
|
||||
const url = process.env.TELEMETRY_URL || 'https://log.evolution-api.com/telemetry';
|
||||
|
||||
axios
|
||||
.post('https://log.evolution-api.com/telemetry', telemetry)
|
||||
.post(url, telemetry)
|
||||
.then(() => {})
|
||||
.catch(() => {});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user