Skip to content

Commit

Permalink
Fix the startup message to use the configured http.options host, do…
Browse files Browse the repository at this point in the history
…n't assume `localhost` (#8078)

Co-authored-by: Daniel Cousens <413395+dcousens@users.noreply.github.com>
  • Loading branch information
u-ishii and dcousens authored Nov 8, 2022
1 parent d29de54 commit b3633c1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/loud-moose-hunt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-6/core': patch
---

Fix the startup message to use the configured `http.options` host instead of assuming `localhost`
5 changes: 3 additions & 2 deletions packages/core/src/scripts/run/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ export const dev = async (cwd: string, shouldDropDatabase: boolean) => {
});

const httpOptions: ListenOptions = {
host: 'localhost',
port: 3000,
};

Expand All @@ -285,9 +286,9 @@ export const dev = async (cwd: string, shouldDropDatabase: boolean) => {
const server = httpServer.listen(httpOptions, (err?: any) => {
if (err) throw err;
// We start initialising Keystone after the dev server is ready,
console.log(`⭐️ Dev Server Starting on http://localhost:${httpOptions.port}`);
console.log(`⭐️ Dev Server Starting on http://${httpOptions.host}:${httpOptions.port}`);
console.log(
`⭐️ GraphQL API Starting on http://localhost:${httpOptions.port}${
`⭐️ GraphQL API Starting on http://${httpOptions.host}:${httpOptions.port}${
config.graphql?.path || '/api/graphql'
}`
);
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/scripts/run/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const start = async (cwd: string) => {
}

const options: ListenOptions = {
host: 'localhost',
port: 3000,
};

Expand All @@ -60,6 +61,6 @@ export const start = async (cwd: string) => {

httpServer.listen(options, (err?: any) => {
if (err) throw err;
console.log(`⭐️ Server Ready on http://localhost:${options.port}`);
console.log(`⭐️ Server Ready on http://${options.host}:${options.port}`);
});
};

1 comment on commit b3633c1

@vercel
Copy link

@vercel vercel bot commented on b3633c1 Nov 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.