Comments (1)
As I'm working through this, a couple more notes of issues and how I'm attempting to solve them. Any feedback on these approaches would be useful. I should have the pull request ready in the next week or so.
Empty Strings
One of the main keys in MeshCentral is the empty string domain key: "domains": { "": { ... } }
. We need a way to represent this key that avoids ambiguity with other possible keys. In Gitea, they use the form _0Xaa_
to represent ASCII characters that aren't legal environment variable characters, where aa
is the two letter ASCII code. For example, in Gitea, the key ui.admin
has the period character, which is not a legal character in environment variables. As such, that key is represented as ui_0X46_admin
.
For the empty string, we can use the null character 0X00
. This would be a special interpretation, but is fairly sensical, and works well. That means our key "domains": {"": {"title": ...} }
would be something like: MC__domains___0X00___title
. Note the three underscores: that's two underscores, indicating a level, and the third underscore for the wrapper on the ASCII character code.
Case Sensitivity
I'm not sure if MeshCentral requires case sensitive keys in the config file, but fortunately, environment variables do not require upper case (it is merely by convention that environment variables are all upper-case). As such, values can be rendered exactly as they are in the name. For example, MC__domains
would be "domains"
and MC__DoMaInS
would be "DoMaInS"
.
This also means that it's not trivial to check for case errors in the environment variables. My approach here is to simply assume the user is casing everything correctly, and blindly incorporate that into the config.json
file.
_Keys (removed config keys)
By convention, Javascript uses _
in front of a name to indicate that it's private. In MeshCentral, we use this convention in the config file to "remove" a variable so that it is not applied in the config.
We can use a special value of _
to indicate that a variable should be disabled. For example, MC__domains=_
would cause the existing "domains": { ... }
key to be replaced with a "_domains": { ... }
key, preserving the existing value under this new _
key.
We can also recognize empty environment variables, and set the value to the empty string. For example, MC__domains=
will preserve the "domains"
key, but set the value to ""
, like: "domains": ""
.
Other Thoughts
This concept was mentioned in #22, so I would hope there's some interest in this setup. In that thread, two tools were suggested that can perform this action using Javascript/Typescript. That may be a better approach to this problem, but I'm woefully unskilled in either of those two languages, so I'm sticking with Shell for this.
After looking through the Dockerfile, I realized that python3
is currently installed as part of the container, which would make Python a first-class citizen in MeshCentral. However, I'm not convinced that Python is actually a requirement for MeshCentral, since I found mentions only in a few workflow pieces, and nothing in the actual code-base. It would seem that python3
is an unnecessary package for the container, and should be removed. As such, I'll hold off on a Python version of this until I hear otherwise that Python is going to stick around.
from meshcentral.
Related Issues (20)
- Add Device to Multiple Device Groups HOT 2
- Thermal Alarm - Notification/Email
- MeshCentral ignores meshcentral-web folder HOT 5
- File uploads are slow, increasing chunk size can help HOT 3
- Sorting active rdp sessions upon connection HOT 10
- Star is in my Devices List view in front of the Device Description HOT 9
- RAM leak to the MeshCentral server HOT 24
- Network adapters without IP addresses are not included in networking list HOT 8
- Event filter in 'My Events' does not work for new events
- only working in local network? HOT 2
- Windows installer "MeshCentralInstaller.exe" don´t work for V 1.1.24 HOT 24
- Regression: AMT Agent connectivity not working in v1.1.24, last known working in v1.1.20 HOT 25
- Add a theme switcher (CSS) and perhaps an icon switcher?
- Move to a GitHub community organization
- Changing filter category menu refills the value in the filter field HOT 5
- Entra ID (Azure AD) auth not working - internal server error HOT 4
- Web chat is not available on agent port and will not function if admin / agent ports are segregated.
- AuthLog: Log unauthorized agent connections, not just connections to the WebUI
- Right click no longer works in Microsoft Edge Version 126.0.2592.87 (Official build) (64-bit)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from meshcentral.