iconify/api

Support for setting host setting

markus-li opened this issue · 3 comments

In some environments it could be beneficial to only listen to a specific interface, such as localhost or a LAN instead of WAN interface.
Basically just a matter of adding the following:

// Create server
app.server.listen(app.config.port, app.config.host, () => {
	app.log('Listening on port ' + app.config.host + ':' + app.config.port);
});

and setting app.config.host = '0.0.0.0' by default to keep the current behavior intact.

Would you accept a pull-request for this?

Sure. PRs for new features are welcome.

I'm rewriting API right now and will also add similar feature to new version.

Ok, I'll fork and create a pull request hopefully over the weekend. Looking forward to seeing your new version.

Implemented in version 3.

Configuration can be set:

  • in src/config/app.ts
  • using env variable HOST: HOST=127.0.0.1 node lib
  • adding value to .env file