-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added interface support #78
base: master
Are you sure you want to change the base?
Conversation
Added the ability to choose by name the interface the server will listen on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, but why did you change the default port to 8002?
Config.js is the place for the default values that get compiled into the exe. User settings should go into the env file.
config.js
Outdated
@@ -4,9 +4,11 @@ const path = require('path'); | |||
|
|||
var config = {}; | |||
|
|||
config.webPort = process.env.WEB_PORT || 8000; | |||
config.webPort = process.env.WEB_PORT || 8002; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to change the default port to 8002. Users can change their port in the env file via "WEB_PORT=".
And config.js is anyways the wrong place to set user config, because it will be compiled into the runtime (for runtime versions). User configuration should be done in the env file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a server running on this port on my dev machine already. I thought I had changed that back before doing the pull request. Sorry. I fixed it now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not directly use config.js for user settings (as it is not available in compiled runtime)!
Instead config.js should only define the default and read the user setting from the env file.
@@ -7,6 +7,8 @@ var config = {}; | |||
config.webPort = process.env.WEB_PORT || 8000; | |||
config.serverVersion = '4.0.136'; | |||
config.apiVersion = '4.0.7'; | |||
//config.interface = 'Wi-Fi' //Windows Name | |||
//config.interface = 'wlan0' //linux name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be done like all the other user configurable presets:
config.interface = process.env.WEB_INTERFACE || null;
Then the user can set the interface in his .env file with:
WEB_INTERFACE = "wlan0"
Added the ability to choose by name the interface the server will listen on.
On my windows machine, it looks to try to listen on an interface without a valid ip (169. etc). This will allow for a config.interface name to be set in config.js and used to discover the correct IP address.