[MAGNOLIA-3516] Allow PropertyInitializer to also use system and environment properties. Created: 19/Jan/11  Updated: 13/Mar/12  Resolved: 09/Mar/12

Status: Closed
Project: Magnolia
Component/s: core
Affects Version/s: 4.3.8, 4.4.1
Fix Version/s: 4.5

Type: Improvement Priority: Neutral
Reporter: Danilo Ghirardelli Assignee: Magnolia International
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File MAGNOLIA-3516-env.patch     Text File MAGNOLIA-3516-test.patch     Text File magnolia-prop.patch    
Issue Links:
relation
is related to MAGNOLIA-2644 Allow property initializer to use als... Closed
is related to MAGNOLIA-3094 Also use contextPath when resolving m... Closed
is related to MAGNOLIA-3521 PropertyInitializer should be pluggable. Closed
Template:
Patch included:
Yes
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Date of First Response:

 Description   

Another strange system architecture required another patch to the property initializer. This time the problem is that all the instances in the cluster must be exactly the same, without the possibility to use a context param just like I did in the other patch. So this time I propose to add also the possibility to use system properties to get the configuration files correctly.
System properties are resolved correctly inside the property file, but they can't be used (at the moment) to resolve the property file itself. The attached patch takes care of the job (it's really minimal).

I know that the entire property initializer should be refactored, even if the patch is not accepted I'd just like to write another real life scenario that should be included in the refactoring...



 Comments   
Comment by Magnolia International [ 19/Jan/11 ]

Hey Danilo,

Thanks for the patch. I'll try to apply it - I'm currently refactoring a lot of the startup stuff (in the magnolia-ioc branch), but I think this part hasn't been touched yet, so i should be able to merge.

Cheers !

Comment by Magnolia International [ 19/Jan/11 ]

And while we're at it, here's an additional patch that should allow using environment properties !

Comment by Magnolia International [ 19/Jan/11 ]

And here's a basic test patch for both features (which will fail on windows ...)

Comment by Danilo Ghirardelli [ 20/Jan/11 ]

Thank you. I thought this issue would stay there for a longer time
I didn't get if you are refactoring even the propertyInitializer class or not, so I added MAGNOLIA-3521 just in case...

Comment by Magnolia International [ 26/Jan/11 ]

Thanks Danilo; indeed PropertyInitializer is being deprecated (just about to commit as I write this).

Left a comment on MAGNOLIA-3521 - thanks for reporting; I thought such an issue already existed, but I can't find it.

Comment by Danilo Ghirardelli [ 26/Jan/11 ]

No, unfortunately... At most is a comment in MAGNOLIA-3094.

Comment by Magnolia International [ 09/Mar/12 ]

This is now possible - DefaultMagnoliaPropertiesResolver takes care of it. One can use paths such as WEB-INF/${systemProperty/testProp}/magnolia.properties or WEB-INF/${env/FOO}/magnolia.properties in their magnolia.initialization.file value.

Generated at Mon Feb 12 03:47:13 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.