Skip to content

Commit af220ae

Browse files
committed
Add configuration for timeout
1 parent c00084f commit af220ae

File tree

5 files changed

+11
-1
lines changed

5 files changed

+11
-1
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ All notable changes to the Ghost Cache Invalidation Proxy will be documented in
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.1.0] - 2025-09-29
9+
10+
### Added
11+
- Configuration option for timeout
12+
813
## [1.0.0] - 2025-03-11
914

1015
### Added

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ghost-cache-invalidation-proxy",
3-
"version": "1.1.0",
3+
"version": "1.2.0",
44
"description": "A proxy between a Ghost CMS instance and configurable webhooks for cache invalidation.",
55
"main": "dist/index.js",
66
"author": "Jannis Fedoruk-Betschki <[email protected]>",

src/config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ const configSchema = z.object({
4242
}),
4343
WEBHOOK_RETRY_COUNT: z.string().transform(Number).default('3'),
4444
WEBHOOK_RETRY_DELAY: z.string().transform(Number).default('1000'),
45+
PROXY_TIMEOUT: z.string().transform(Number).default('600000'),
4546
});
4647

4748
export function loadConfig(): MiddlewareConfig {
@@ -70,6 +71,7 @@ export function loadConfig(): MiddlewareConfig {
7071
retryCount: data.WEBHOOK_RETRY_COUNT,
7172
retryDelay: data.WEBHOOK_RETRY_DELAY,
7273
},
74+
proxyTimeout: data.PROXY_TIMEOUT,
7375
security: {
7476
trustProxy: true,
7577
}

src/middleware.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ export class ProxyMiddleware {
2020
changeOrigin: true,
2121
selfHandleResponse: true,
2222
xfwd: true,
23+
timeout: this.config.proxyTimeout,
24+
proxyTimeout: this.config.proxyTimeout,
2325
headers: {
2426
'X-Forwarded-Proto': 'https'
2527
}

src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export interface MiddlewareConfig {
1212
retryCount: number;
1313
retryDelay: number;
1414
};
15+
proxyTimeout: number;
1516
security: {
1617
trustProxy: boolean;
1718
};

0 commit comments

Comments
 (0)