Skip to content

Commit 67529a7

Browse files
authored
Merge branch 'main' into dependabot/npm_and_yarn/backend/development-dependencies-42c55dc180
2 parents d5db1b1 + 61708ee commit 67529a7

File tree

58 files changed

+4132
-314
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+4132
-314
lines changed

.DS_Store

0 Bytes
Binary file not shown.

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"eslint.workingDirectories": [ "./backend", "./frontend" ],
3+
}

backend/jest.config.ts

Lines changed: 0 additions & 23 deletions
This file was deleted.

backend/package-lock.json

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"cors": "^2.8.5",
2121
"cron": "^4.1.3",
2222
"date-fns": "^4.1.0",
23+
"dayjs": "^1.11.13",
2324
"dotenv": "^16.4.7",
2425
"eventsource": "^3.0.6",
2526
"express": "^4.21.2",

backend/src/app.ts

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,15 @@ class App {
3232
// throw new Error('MONGODB_URI must be set');
3333
// }
3434
this.database = new Database();
35+
36+
// Create webhook service with just port/path, but without URL
37+
// The URL will be populated from settings later
3538
const webhookService = new WebhookService({
36-
url: process.env.WEBHOOK_PROXY_URL,
39+
url: process.env.WEBHOOK_PROXY_URL || undefined, // Use env value or undefined
3740
path: '/api/github/webhooks',
3841
port
3942
});
43+
4044
this.github = new GitHub(
4145
{
4246
// adding GH_APP_* so you can set these as codespaces secrets, can't use GITHUB_* as a prefix for those
@@ -88,7 +92,7 @@ class App {
8892
await TargetValuesService.initialize();
8993
logger.info('Targets initialized');
9094
} catch (error) {
91-
logger.warn('GitHub App failed to connect', (error as any)?.message || error);
95+
logger.warn('GitHub App failed to connect', error instanceof Error ? error.message : String(error));
9296
}
9397

9498
}
@@ -135,7 +139,7 @@ class App {
135139
logger.info(`eListener on port ${this.port} (http://localhost:${this.port})`);
136140
}
137141

138-
private initializeSettings() {
142+
private async initializeSettings() {
139143
return this.settingsService.initialize()
140144
.then(async (settings) => {
141145
if (settings.webhookSecret) {
@@ -151,11 +155,27 @@ class App {
151155
if (settings.baseUrl) {
152156
this.baseUrl = settings.baseUrl;
153157
}
158+
159+
// Add this section to properly set the webhook URL from settings
160+
if (settings.webhookProxyUrl) {
161+
// Update the webhook service with the stored URL
162+
await this.github.webhookService.connect({ url: settings.webhookProxyUrl });
163+
logger.info(`Using stored webhook URL: ${settings.webhookProxyUrl}`);
164+
}
154165
})
155166
.finally(async () => {
156167
await this.settingsService.updateSetting('webhookSecret', this.github.input.webhooks?.secret || '', false);
157168
await this.settingsService.updateSetting('webhookProxyUrl', this.github.webhookService.url!, false);
158169
await this.settingsService.updateSetting('metricsCronExpression', this.github.cronExpression!, false);
170+
171+
// Make sure we store the current URL after connection
172+
const currentUrl = this.github.webhookService.url;
173+
if (currentUrl) {
174+
await this.settingsService.updateSetting('webhookProxyUrl', currentUrl, false);
175+
logger.info(`Saved webhook URL: ${currentUrl}`);
176+
} else {
177+
logger.warn('No webhook URL available to save');
178+
}
159179
})
160180
}
161181
}

0 commit comments

Comments
 (0)