Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PP-13145: Bind to localhost by default instead of 0.0.0.0 #3900

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ Run in two separate terminals:

| variable | required | default value | Description |
|:---------------------------------------|:--------:|:-------------------------------------------------------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------|
| `BIND_HOST` | | 127.0.0.1 | The IP address for the application to bind to. |
| `PORT` | X | 9200 | The port number for the express server to be bound at runtime |
| `SESSION_ENCRYPTION_KEY` | X | | key to be used by the cookie encryption algorithm. Should be a large unguessable string ([More Info](https://www.npmjs.com/package/client-sessions)). |
| `CONNECTOR_TOKEN_URL` | X | | The connector endpoint to use when validating the one time token. |
Expand Down
7 changes: 5 additions & 2 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const { requestContextMiddleware } = require('./app/services/clients/base/reques
const {
NODE_ENV,
PORT,
BIND_HOST,
ANALYTICS_TRACKING_ID,
GOOGLE_PAY_MERCHANT_ID,
WORLDPAY_APPLE_PAY_MERCHANT_ID_CERTIFICATE,
Expand Down Expand Up @@ -160,8 +161,10 @@ function setNoCacheHeadersForRoutes (app) {

function listen () {
const app = initialise()
app.listen(PORT || 3000)
logger.info('Listening on port ' + PORT || 3000)
const DEFAULT_PORT = 3000
const DEFAULT_BIND_HOST = "127.0.0.1"
app.listen(PORT || DEFAULT_PORT, BIND_HOST || DEFAULT_BIND_HOST)
logger.info(`Listening on ${BIND_HOST || DEFAULT_BIND_HOST}:${PORT || DEFAULT_PORT}`)
}

function logApplePayCertificateTimeToExpiry () {
Expand Down
Loading