Skip to content

Commit 8e8735c

Browse files
committed
adding global targetOverride config
1 parent 678949c commit 8e8735c

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ service.start(3000)
4242
middlewares: [],
4343
// Optional global value for routes "pathRegex". Default value: '/*'
4444
pathRegex: '/*',
45+
// Optional "target" value that overrides the routes "target" config value. Feature intended for testing purposes.
46+
targetOverride: "https://yourdev.api-gateway.com",
4547

4648
// HTTP proxy
4749
routes: [{

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const gateway = (opts) => {
4343

4444
// instantiate route proxy
4545
const { proxy } = fastProxy({
46-
base: route.target,
46+
base: opts.targetOverride || route.target,
4747
http2: !!route.http2,
4848
...(opts.fastProxy)
4949
})

0 commit comments

Comments
 (0)