Skip to content

problems with complex configuration values #24

@santiagozky

Description

@santiagozky

Im trying to apply certain values for a specific osgi configuration org.apache.sling.caconfig.impl.override.OsgiConfigurationOverrideProvider . This configuration is a multivalue property with a rather complex format for each one:
[{contextPath}]{configName}/{propertyName}={propertyJsonValue}
or
[{contextPath}]{configName}={propertyJsonValue}
this presents some issues:

  • being multivalue string means each entry need to be between quotes
  • there is a equal sign that needs escaping
  • the json needs proper escaping

Unfortunately I haven't found a way to properly escape the configurations.

For example, this format as an environment variable:
[\"[a]b={'a':true}\",\"[w]x/y={'z':true}\"]

is displayed like this in the groovy console

["[a]b={'a':true}","[w]x/y={'z':true}"]

and leads to the property in the file being written as
[\"[a]b={'a':true}\",\"[w]x/y={'z':true}\"]

Notice that the quotes that should encompass each value have been escaped, though they are not properly picked as individual properties

I think the issue is in VariablesMerger L89
valueToBeUsed = valueToBeUsed.replaceAll("([\\\\=\\s\"])", "\\\\$1");

Where the quote character is escaped every time, making multivalue properties not possible to set.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions