feat(config): add telemetry and metrics configuration options

- Introduce new environment variables for telemetry and Prometheus metrics in .env.example
- Create example configuration files for Prometheus and Grafana dashboards
- Update main application to utilize new configuration settings for Sentry, audio converter, and proxy
- Enhance channel services to support audio conversion API integration
- Implement middleware for metrics IP whitelisting and basic authentication in routes
This commit is contained in:
Davidson Gomes
2025-09-17 16:50:36 -03:00
parent 81a991a62e
commit 3ddbd6a7fb
16 changed files with 538 additions and 44 deletions

View File

@@ -62,6 +62,7 @@ import { ChannelStartupService } from '@api/services/channel.service';
import { Events, MessageSubtype, TypeMediaMessage, wa } from '@api/types/wa.types';
import { CacheEngine } from '@cache/cacheengine';
import {
AudioConverter,
CacheConf,
Chatwoot,
ConfigService,
@@ -2837,7 +2838,8 @@ export class BaileysStartupService extends ChannelStartupService {
}
public async processAudio(audio: string): Promise<Buffer> {
if (process.env.API_AUDIO_CONVERTER) {
const audioConverterConfig = this.configService.get<AudioConverter>('AUDIO_CONVERTER');
if (audioConverterConfig.API_URL) {
this.logger.verbose('Using audio converter API');
const formData = new FormData();
@@ -2847,8 +2849,8 @@ export class BaileysStartupService extends ChannelStartupService {
formData.append('base64', audio);
}
const { data } = await axios.post(process.env.API_AUDIO_CONVERTER, formData, {
headers: { ...formData.getHeaders(), apikey: process.env.API_AUDIO_CONVERTER_KEY },
const { data } = await axios.post(audioConverterConfig.API_URL, formData, {
headers: { ...formData.getHeaders(), apikey: audioConverterConfig.API_KEY },
});
if (!data.audio) {