[core] add WAHA_BASE_URL to override media URLs

This commit is contained in:
devlikepro committed 2024-09-27 16:34:37 +07:00
1 parent 0779e326d7
commit 1d30bb7e8e
2 files changed
+11 -1

No files matched your search

+10
View File
@@ -24,6 +24,16 @@ export class WhatsappConfigService {
return this.configService.get('WHATSAPP_API_PORT', '3000');
}
get baseUrl(): string {
let baseUrl = this.configService.get('WAHA_BASE_URL', '');
if (!baseUrl) {
// combine schema+hostname+port
baseUrl = `${this.schema}://${this.hostname}:${this.port}`;
}
// remove / at the end
return baseUrl.replace(/\/$/, '');
}
get mimetypes(): string[] {
if (!this.shouldDownloadMedia) {
return ['mimetype/ignore-all-media'];
@@ -8,7 +8,7 @@ export class MediaLocalStorageConfig {
constructor(private config: WhatsappConfigService) {}
get filesURL(): string {
return `${this.config.schema}://${this.config.hostname}:${this.config.port}${this.filesUri}/`;
return `${this.config.baseUrl}${this.filesUri}/`;
}
get filesFolder(): string {