-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into new-instrumentation
- Loading branch information
Showing
11 changed files
with
207 additions
and
266 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import * as t from "tap"; | ||
import { trustProxy } from "./trustProxy"; | ||
|
||
t.beforeEach(() => { | ||
delete process.env.AIKIDO_TRUST_PROXY; | ||
}); | ||
|
||
t.test("the default is true", async () => { | ||
t.equal(trustProxy(), true); | ||
}); | ||
|
||
t.test("trust proxy set to false", async () => { | ||
process.env.AIKIDO_TRUST_PROXY = "false"; | ||
t.equal(trustProxy(), false); | ||
}); | ||
|
||
t.test("trust proxy set to true", async () => { | ||
process.env.AIKIDO_TRUST_PROXY = "true"; | ||
t.equal(trustProxy(), true); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { envToBool } from "./envToBool"; | ||
|
||
export function trustProxy() { | ||
if (!process.env.AIKIDO_TRUST_PROXY) { | ||
// Trust proxy by default | ||
// Most of the time, the application is behind a reverse proxy | ||
return true; | ||
} | ||
|
||
return envToBool(process.env.AIKIDO_TRUST_PROXY); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.