Problem Description: As discovered in https://github.com/Ylianst/MeshCentral/issues/1206, in Linux with the current version of MeshCentral, in those instances where the config.js is being called, you must run meshctrl.js from the installation directory.
Example:
If we run meshctrl.js with a request that calls the config.js from the installation directory it works as expected:
# cd /opt/meshcentral/
# /usr/bin/node /opt/meshcentral/node_modules/meshcentral/meshctrl.js Config --show
{
"settings": {
"Port": 443,
"RedirPort": 80,
...}
If we run it from somewhere else, it does not:
# cd /
# /usr/bin/node /opt/meshcentral/node_modules/meshcentral/meshctrl.js Config --show
Unable to find config.json.
However, if we use a command that does not require the config.js to be called, it works from anywhere:
# cd /
# /usr/bin/node /opt/meshcentral/node_modules/meshcentral/meshctrl.js ListDeviceGroups --loginuser admin --loginpass admin123 --url wss://192.168.1.130/domain10
id, name
---------------
"RmKNVeBiNnLFnUgbVQk65jNKjf5UReb9Tq0$y57OK7MBw2P4lidZIb9r7vBgFtZ1", "test"
Ask: Allow meshctrl.js commands which call config.js to be run from anywhere. This may not be possible with meshctrl's portability, therefore, if it's difficult/impossible to do, a simple (but somewhat less desirable) work around may be to add some additional guidance to the error message; Instead of:
Unable to find config.json. maybe something like Unable to find config.json, are you in the program's working directory?
As always, thanks for all your hard work!
Oh yes, that is not good. I will fix this now.
Just submitted a fix for this, it will be in v0.5.70 when it's next published later today. As always, thank you very much for the detailed reports. Always outstanding.
Fix works, as usual :)
Tested in v0.5.72, works as expected, closing.
# cd /
# /usr/bin/node /opt/meshcentral/node_modules/meshcentral/meshctrl.js Config --show
{
"settings": {
"Port": 443,
"RedirPort": 80,
"LANonly": true,
...
}
Thanks for the quick fix! 11/10 dev team
Most helpful comment
Just submitted a fix for this, it will be in v0.5.70 when it's next published later today. As always, thank you very much for the detailed reports. Always outstanding.