I guess I found the culprit.
FeatureConfigInstaller uses TypedProperties to load the properties from the
feature config element.
Apparently TypedProperties performs variable interpolation and replaces my
placeholders. I still don't understand why sometimes they are replaced and
other times they don't

João Assunção

Email: [email protected]
Mobile: +351 916968984
Phone: +351 211933149
Web: www.exploitsys.com




On Thu, May 20, 2021 at 4:47 PM João Assunção <[email protected]>
wrote:

> Hello JB
>
> Yes I'm using Karaf 4.3.0
>
> I tried with override="true", specifying the placeholder value in
> custom.properties, and with -D. The behavior is the same.
> For the same feature, some cfg files keep the placeholder while others
> have the placeholder replaced by an empty string.
> Another weird behavior is that this doesn't occur in my machine but
> occurs in two other machines. All them are Linux machines running openjdk
> but mine is a bit slower.
>
> I will try to use the <configfile> element instead of <config>
>
>
>
> João Assunção
>
> Email: [email protected]
> Mobile: +351 916968984
> Phone: +351 211933149
> Web: www.exploitsys.com
>
>
>
>
> On Thu, May 20, 2021 at 3:54 PM Jean-Baptiste Onofre <[email protected]>
> wrote:
>
>> Hi,
>>
>> If you want to always take config content from the features, you can user
>> overwrite="true" flag.
>>
>> You can override with -D (see http://blog.nanthrax.net/?p=1038).
>>
>> I guess you are using Karaf 4.3.x right ?
>>
>> Regards
>> JB
>>
>> Le 20 mai 2021 à 16:33, João Assunção <[email protected]> a
>> écrit :
>>
>> Hello all,
>>
>> I'm trying to use placeholders in configurations but I noticed some weird
>> behavior. Sometimes the placeholder is replaced by an empty string, in
>> other situations by the value of the property and in others not replaced at
>> all.
>>
>> One of my features contains the following configurations:
>> ...
>> <config
>> name="com.atobe.ort.photo.repository.PhotoRepositoryServiceProvider"
>> append="false">
>>         storageDirectory=${tzc.data}/photos
>> </config>
>> <config
>> name="pt.brisa.service.metrics.rrd.internal.RRDPersistenceServiceProvider"
>> append="false">
>>             rrdDefFile = etc/tzc_metrics.xml
>>             rrdRepository = ${tzc.data}/rrd
>>             reportingInterval = 60
>> </config>
>> ..
>>
>> When the feature is installed, with tzc.data set to "myData", sometimes i
>> get the following cfg files:
>> *== com.atobe.ort.photo.repository.PhotoRepositoryServiceProvider.cfg ==*
>> storageDirectory=${tzc.data}/photos
>> org.apache.karaf.features.configKey =
>> com.atobe.ort.photo.repository.PhotoRepositoryServiceProvider
>>
>> *==
>> pt.brisa.service.metrics.rrd.internal.RRDPersistenceServiceProvider.cfg ==*
>> rrdDefFile = etc/tzc_metrics.xml
>> rrdRepository = myData/rrd
>> reportingInterval = 60
>> org.apache.karaf.features.configKey =
>> pt.brisa.service.metrics.rrd.internal.RRDPersistenceServiceProvider
>>
>> I tried specifying the variable name in config.properties and using  the
>> -D  flag
>>
>> Ideally I would like the placeholder to be replaced by the actual value
>> only when the configuration is passed to the service.
>>
>> What am I doing wrong ?
>>
>> Thank you in advance.
>>
>> Best regards,
>> João Assunção
>>
>> Email: [email protected]
>> Mobile: +351 916968984
>> Phone: +351 211933149
>> Web: www.exploitsys.com
>>
>>
>>
>>

Reply via email to