|
|
|
@ -43,6 +43,23 @@ export class WebhookManager {
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
const url = new URL(process.env.WEBHOOK_URL);
|
|
|
|
|
|
|
|
|
|
// Enhanced internal Docker URL validation
|
|
|
|
|
if (process.env.WEBHOOK_URL.startsWith('http://srv-captain--')) {
|
|
|
|
|
if (!url.port) {
|
|
|
|
|
console.warn('⚠️ Internal Docker URL missing port number - this may cause connection issues');
|
|
|
|
|
// Auto-fix for common CapRover default port
|
|
|
|
|
if (process.env.PORT) {
|
|
|
|
|
process.env.WEBHOOK_URL = process.env.WEBHOOK_URL.replace(
|
|
|
|
|
'http://srv-captain--',
|
|
|
|
|
`http://srv-captain--:${process.env.PORT}/`
|
|
|
|
|
);
|
|
|
|
|
console.warn(`⚠️ Auto-corrected URL to: ${process.env.WEBHOOK_URL.substring(0, 30)}...`);
|
|
|
|
|
return; // Skip further validation for corrected URL
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Allow internal docker URLs in production
|
|
|
|
|
if (process.env.NODE_ENV === 'production') {
|
|
|
|
|
if (!['http:', 'https:', 'http://srv-captain--'].some(prefix =>
|
|
|
|
|