Skip to content

Commit

Permalink
Listen on all ipv4 and ipv6 interfaces by default (#34)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Chambers <[email protected]>
  • Loading branch information
shahidhk and daniel-chambers authored Jul 30, 2024
1 parent 8310045 commit e68e5b8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## Unreleased
- The connector now listens on both ipv4 and ipv6 interfaces by default. This can be configured by using the `HASURA_CONNECTOR_HOST` environment variable, which sets the host the web server listens on.

## 5.1.0
- Updated to support [v0.1.4 of the NDC Spec](https://hasura.github.io/ndc-spec/specification/changelog.html#014) ([#33](https://github.com/hasura/ndc-sdk-typescript/pull/33))
- Support for [aggregates](https://hasura.github.io/ndc-spec/specification/queries/aggregates.html) over nested fields
Expand Down
5 changes: 5 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ export function getServeCommand<Configuration, State>(
.env("HASURA_CONFIGURATION_DIRECTORY")
.makeOptionMandatory(true)
)
.addOption(
new Option("--host <host>")
.env("HASURA_CONNECTOR_HOST")
.default("::")
)
.addOption(
new Option("--port <port>")
.env("HASURA_CONNECTOR_PORT")
Expand Down
3 changes: 2 additions & 1 deletion src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const errorResponses = {

export interface ServerOptions {
configuration: string;
host: string;
port: number;
serviceTokenSecret: string | undefined;
logLevel: string;
Expand Down Expand Up @@ -312,7 +313,7 @@ export async function startServer<Configuration, State>(
});

try {
await server.listen({ port: options.port, host: "0.0.0.0" });
await server.listen({ port: options.port, host: options.host });
} catch (error) {
server.log.error(error);
process.exitCode = 1;
Expand Down

0 comments on commit e68e5b8

Please sign in to comment.