Ylianst/MeshCentralRouter

Using Application Settings for Custom Builds

JosephMDavis opened this issue · 1 comments

Hey all,

I think it would be very nice if we could customize the build of MeshCentralRouter so when it is built the customizations are more-or-less baked into the compiled exe. This would make distribution of the executable easier because it would be a single file and not need any customization files that the end user would see and possibly modify.

Looking through the code, I implemented a simple method of doing this with "Application Settings" that doesn't remove any current functionality.

Basically, things like which buttons to show (install, website, etc...), double-click action, allowing command line args, etc... are controlled through Application scoped settings. The customization options which @Ylianst added with #10 are still there as well, albeit controlled by Application scoped settings. I'll be adding options for hiding the creation of port mappings to prevent the user from doing that themselves as we're mostly going to use Router as a Work from Home tool.

When using this method, a MeshCentralRouter.exe.config file is created on build and output with the exe but it doesn't have to be deployed with the exe. Any settings the developer set are the default settings for the compiled exe. For my purposes, this is okay, although I would like to prevent the use of the config file entirely.

I know there is a MeshCentral issue (3688) to include MeshCentral config options with the exe download so things are done in a single place. I think that's great but Ylianst has said that it would be a big undertaking and it would more than likely result in the use of customization files that have to coexist with the exe.

Ultimately, what I'm after here, is some feedback from @Ylianst and the community on whether what I've come up with is something that would be included in the core. If it is, I'll gladly create a PR. My initial code is here. The biggest reason I think this method would be useful to everyone is that it would mean a developer could customize the compiled exe, provide a single exe to their users, and pull in future changes to Router without having to merge those changes with a heavily customized source code.

Finally, in order for this all to work the way I want, I need to be able to replace the exe that is downloaded from my MeshCentral server and I haven't found where to do that. I know that would mean keeping the version of Router in sync with the version of MeshCentral I'm running but that doesn't seem to be a hard task. Any help in that respect would be very much appreciated.

Does anyone have any thoughts on this?