Skip to content

Commit

Permalink
fix: set default host to undefined (#3362)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando authored Oct 19, 2023
1 parent f8e9776 commit 6a30ab0
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .env.app.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# The host address to bind to. Default is `::`
# The host address to bind to
# HOST="::"
# The port to listen to for incoming requests. Default is `8091`
# PORT=8091
Expand Down
4 changes: 2 additions & 2 deletions app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ let restarting = false
/**
* Start http/https server and all the manager
*/
export async function startServer(host: string, port: number | string) {
export async function startServer(port: number | string, host?: string) {
let server: HttpServer

const settings = jsonStore.get(store.settings)
Expand Down Expand Up @@ -215,7 +215,7 @@ export async function startServer(host: string, port: number | string) {
const bind =
typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr?.port
logger.info(
`Listening on ${bind} host ${host} protocol ${
`Listening on ${bind}${host ? 'host ' + host : ''} protocol ${
httpsEnabled ? 'HTTPS' : 'HTTP'
}`,
)
Expand Down
2 changes: 1 addition & 1 deletion bin/www.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jsonStore
const port = normalizePort(conf.port)
app.set('port', port)

return startServer(conf.host, port)
return startServer(port, conf.host)
})
.catch((err: unknown) => {
console.error(err)
Expand Down
2 changes: 1 addition & 1 deletion config/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ export const defaultPsw: string = 'zwave'
export const sessionSecret: string = process.env.SESSION_SECRET || 'DEFAULT_SESSION_SECRET_CHANGE_ME'
export const base: string = process.env.BASE_PATH || '/'
export const port: string | number = process.env.PORT || 8091
export const host: string = process.env.HOST || '::'
export const host: string = process.env.HOST // by default undefined, so it will listen on all interfaces both ipv4 and ipv6
2 changes: 1 addition & 1 deletion docs/guide/env-vars.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This is the list of the supported environment variables:
- `SESSION_SECRET`: Used as secret for session. If not provided the default one is used
- `USE_SECURE_COOKIE`: Set the cookie [secure](https://github.com/expressjs/session#cookiesecure) option.
- `PORT`: The port to listen to for incoming requests. Default is `8091`
- `HOST`: The host address to bind to. Default is `::`
- `HOST`: The host address to bind to. Keep it empty to bind to all interfaces both IPv4 and IPv6
- `STORE_DIR`: The absolute path to the directory where all files will be stored. Default is `<path to your zui dir>/store`
- `BACKUPS_DIR`: The absolute path to the directory where all backups files will be stored. Default is `<path to your zui dir>/store/backups`
- `ZWAVEJS_EXTERNAL_CONFIG`: Mostly needed for docker users, it's the path to the folder used by Z-Wave JS to [store config database](https://zwave-js.github.io/node-zwave-js/#/usage/external-config?id=specifying-an-external-config-db-location), by default on docker it is `/usr/src/app/store/.config-db`. For users that are using a custom `STORE_DIR` this must be changed too.
Expand Down
2 changes: 1 addition & 1 deletion src/views/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1233,7 +1233,7 @@
<v-text-field
v-model="newZwave.serverHost"
label="Server Host"
hint="(Optional) The host to bind the Z-Wave Server. Default is: ::"
hint="(Optional) The host to bind the Z-Wave Server"
></v-text-field>
</v-col>
<v-col
Expand Down

0 comments on commit 6a30ab0

Please sign in to comment.