One user has run into a problem running WebControl concurrently with some other applications on their RPI. WebControl uses port 5000, which is the default port for flask (webcontrol’s webserver) and other programs sometimes also use the default port. I can change the webcontrol port to something else and/or make it configurable. Changing it isn’t hard, it just would require everyone to start going to some different port… but then what happens if that new port conflicts with something… Making it configurable is better, but a bit more challenging.
If I make the port setting for WebControl a standard setting of webcontrol.json and a user is experiencing a conflict and is unable to start webcontrol, they have to manually edit the webcontrol.json file. I can make it a setting of WebMCP, but what if you have a conflict with WebMCP and you can’t bring it up either.
My thinking is that manually editing the webcontrol.json or webmcp.json files is probably a bad thing… one little mistake or mistyped punctuation mark and the whole thing craps out. So, I thought about doing something like the RPI does with SSH access. I could have each WebMCP and WebControl look for the presence of a file in the .WebControl directory. If the file is there, then it parses the filename for the port assignment and sets the setting for the user. That way, all a user with an issue would have to do is to enter SSH or terminal and issue a simple touch command:
The program would look for files starting with webcontrol and an extension of port and then parse the port number from it (5080 in the above example). Same with webmcp-5081.port. Once the program updates the settings in webcontrol.json and webmcp.json, it then deletes those files. After that, the user can change the port assignments in the future using the browser.
I don’t believe there will be an issue with the use of the .WebControl directory because either program (WebMCP or WebControl) will create the directory if it doesn’t exist when its run even if it is unable to bind to a network port. So once the user tries to run either and gets a port-conflict message, the directory will have already been created and the user can then touch a file inside that directory.
Is there a better ways of doing this?