Skip to content

Commit

Permalink
Merge pull request #1269 from alphagov/pp-13145/set-bind-host-address
Browse files Browse the repository at this point in the history
PP-13145: Accept BIND_HOST env var and default to localhost
  • Loading branch information
jfharden authored Sep 9, 2024
2 parents c15ecaf + 0620047 commit 0582f34
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The service provides an API that can be accessed to retrieve card information fo
## Environment Variables

- `ADMIN_PORT`: The port number to listen for Dropwizard admin requests on. Defaults to `8081`.
- `BIND_HOST`: The IP address for the application to bind to. Defaults to `127.0.0.1`
- `JAVA_OPTS`: Options to pass to the JRE. Defaults to `-Xms1500m -Xmx1500m`.
- `PORT`: The port number to listen for requests on. Defaults to `8080`.
- `TEST_CARD_DATA_LOCATION`: The path to load bin ranges for test cards from. Defaults
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/config/config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
server:
applicationConnectors:
- type: http
bindHost: ${BIND_HOST:-127.0.0.1}
port: ${PORT:-8080}
adminConnectors:
- type: http
bindHost: ${BIND_HOST:-127.0.0.1}
port: ${ADMIN_PORT:-8081}
requestLog:
appenders:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ public class CardIdResourceITest {
CardApi.class
, resourceFilePath("config/config.yaml")
, config("server.applicationConnectors[0].port", "0")
, config("server.applicationConnectors[0].bindHost", "127.0.0.1")
, config("server.adminConnectors[0].port", "0")
, config("server.adminConnectors[0].bindHost", "127.0.0.1")
, config("worldpayDataLocation", "file://" + resourceFilePath("card-id-resource-integration-test/worldpay-bin-ranges.csv"))
, config("discoverDataLocation", "file://" + resourceFilePath("card-id-resource-integration-test/discover-bin-ranges.csv"))
, config("testCardDataLocation", "file://" + resourceFilePath("card-id-resource-integration-test/test-bin-ranges.csv")));
Expand All @@ -32,7 +34,9 @@ public class CardIdResourceITest {
CardApi.class
, resourceFilePath("config/config.yaml")
, config("server.applicationConnectors[0].port", "0")
, config("server.adminConnectors[0].port", "0"));
, config("server.applicationConnectors[0].bindHost", "127.0.0.1")
, config("server.adminConnectors[0].port", "0")
, config("server.adminConnectors[0].bindHost", "127.0.0.1"));

@Test
public void shouldFindDiscoverCardInformation() {
Expand Down

0 comments on commit 0582f34

Please sign in to comment.