Skip to content
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

Merged
merged 7 commits into from
Oct 29, 2024

Commits on Oct 25, 2024

  1. 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.
    fmoessbauer committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    7fcbbe9 View commit details
    Browse the repository at this point in the history
  2. 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.
    fmoessbauer committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    1abb9fb View commit details
    Browse the repository at this point in the history
  3. 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.
    fmoessbauer committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    839bbbc View commit details
    Browse the repository at this point in the history
  4. refactor camel and snake naming in setPref

    Same change as done in getPerf to have less branches (simplifies the
    code).
    fmoessbauer committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    4c29d7d View commit details
    Browse the repository at this point in the history
  5. 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.
    fmoessbauer committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    6ceae7c View commit details
    Browse the repository at this point in the history
  6. 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.
    fmoessbauer committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    4ca13bc View commit details
    Browse the repository at this point in the history
  7. 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.
    fmoessbauer committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    578d3e4 View commit details
    Browse the repository at this point in the history