-
Notifications
You must be signed in to change notification settings - Fork 170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A lot of fixes around setting / retrieving base64 encoded values #701
Commits on Oct 25, 2024
-
refactor camel and snake naming in getPref
We have a lot of code duplication by checkin over and over again if field should be named in camel or snake notation. We simplify this by writing the choosen variant into a variable and just use that name across the code. No functional change.
Configuration menu - View commit details
-
Copy full SHA for 7fcbbe9 - Browse repository at this point
Copy the full SHA 7fcbbe9View commit details -
refactor getPref to use uniform printing logic
We add a local helper function to print a single setting. This is a preparation to correctly print non-trivial types. The existing code in getPref is ported over to use that function. By that, the output of "wholeField" is changed slightly to always print the full path for each setting (e.g. "security.serialEnabled" instead of "security:\nserialEnabled"). This improves support for grepping on the output.
Configuration menu - View commit details
-
Copy full SHA for 1abb9fb - Browse repository at this point
Copy the full SHA 1abb9fbView commit details -
config: correctly print byte and array types on get
When getting config values of type bytes or list (technically a protobuf repeated container type), these were directly printed on the output. However, the retrieved values could not be set by --set again, as the format was different (e.g. python string representation of bytes vs. base64 prefixed and encoded as expected by --set). We fix this by adding a toStr utility function (similar to the fromStr) function to convert byte types correctly to the base64 representation. Further, we check if the type is repeated and apply this operation to all values.
Configuration menu - View commit details
-
Copy full SHA for 839bbbc - Browse repository at this point
Copy the full SHA 839bbbcView commit details -
refactor camel and snake naming in setPref
Same change as done in getPerf to have less branches (simplifies the code).
Configuration menu - View commit details
-
Copy full SHA for 4c29d7d - Browse repository at this point
Copy the full SHA 4c29d7dView commit details -
setPref: pass typed value instead of string
By passing a typed value we can conserve the type information to later use that to convert it back into the correct protobuf type. The type conversion is now done inside setPref.
Configuration menu - View commit details
-
Copy full SHA for 6ceae7c - Browse repository at this point
Copy the full SHA 6ceae7cView commit details -
fix setting of list item on configure
When setting the whole configuration via --configure, list types like adminKey need special handling. Previously this failed as a list cannot be appended to a list. The new code adds dedicated logic to replace the repeated value when passing a list. Also, all items of that list are converted into the correct (typed) form before setting them.
Configuration menu - View commit details
-
Copy full SHA for 4ca13bc - Browse repository at this point
Copy the full SHA 4ca13bcView commit details -
do not double-print value when setting a repeated value
When clearning or appending to a repeated value, both the "Clearing..." / "Adding..." line and the "Set..." line were shown. However, this is misleading as the only performed operation is the clearing / appending. We fix this by directly returning from the function in case of clearing / appending.
Configuration menu - View commit details
-
Copy full SHA for 578d3e4 - Browse repository at this point
Copy the full SHA 578d3e4View commit details