fix: Deeply nested lines causing panic when saving config#783
fix: Deeply nested lines causing panic when saving config#783JosephKav merged 1 commit intorelease-argus:masterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #783 +/- ##
==========================================
- Coverage 98.96% 98.82% -0.14%
==========================================
Files 137 137
Lines 9218 9222 +4
==========================================
- Hits 9122 9113 -9
- Misses 73 84 +11
- Partials 23 25 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Nice fix, thanks for doing this. Didn't account for the possibility of deeply nested config! w.r.t wanting a read-only config, you can disable the routes that modify the config - https://release-argus.io/docs/config/settings/ settings:
web:
disabled_routes:
- service_create # Creation of new services
- service_update # Updating of existing services
- service_delete # Deletion of services |
Thanks :) And no problem at all!
That's fair, but what I've noticed is that with a read-only file (such as what happens when you mount a Kubernetes ConfigMap into the pod but the behavior can be replicated by providing it with any read-only config file), Argus will now still try to update the file shortly after startup, even though those endpoints are disabled. My guess is that this happens because it tries to write back the massaged (with reordering etc done) config file back to disk. |
|
Oh yeah, it'll save if your config is modified on startup. I'll add a config/cli setting for readonly mode |
When the config file contained a deeply nested line (for example, see my nested JSON here) this would crash the
reorderYAMLfunction as theparentKeyslice was limited to only 10 items.This PR grows the
parentKeyautomatically if needed so that these config files can be parsed again.Side note: this behavior of automatically modifying/sorting and saving the configuration file breaks the usage pattern where the configuration file is read-only (for example when being mounted from a Kubernetes ConfigMap). Is there a way to disable this behavior?