Ext placeholder does not seem to resolve variables set in the custom.properties file.
Is there anything to configure? PS: thank you all for your answers! :) JP [@@ OPEN @@] De : Guillaume Nodet [mailto:[email protected]] Envoyé : lundi 13 avril 2015 15:21 À : user Objet : Re: Environment variables and Blueprint To use env variables in etc/custom.properties, you should be able to do my.system.property = ${env:MY_ENV_VAR} and then, you should be able to use ${my.system.property} in blueprint files. 2015-04-13 14:32 GMT+02:00 Jean-Baptiste Onofré <[email protected]<mailto:[email protected]>>: In that case, you can also use etc/custom.properties Regards JB On 04/13/2015 02:24 PM, Charlie Mordant wrote: Hi Jean Philippe, Just pass your Unix env variable as VM arguments when you start your VM/Karaf! ./karaf -DmyVMKey=$MyUnixENVVar There's also a Karaf file in the bin folder where you can put your VM args (env file). Regards, 2015-04-13 13:56 GMT+02:00 CLEMENT Jean-Philippe <[email protected]<mailto:[email protected]> <mailto:[email protected]<mailto:[email protected]>>>: I wasn't clear, sorry. I'm talking about Unix env variables. Is there a way to get them? JP [@@ OPEN @@] -----Message d'origine----- De : Jean-Baptiste Onofré [mailto:[email protected]<mailto:[email protected]> <mailto:[email protected]<mailto:[email protected]>>] Envoyé : lundi 13 avril 2015 13:38 À : [email protected]<mailto:[email protected]> <mailto:[email protected]<mailto:[email protected]>> Objet : Re: Environment variables and Blueprint Did you try: <ext:property-placeholder placeholder-prefix="$[" placeholder-suffix="]"/> ? By system variables, do you mean JVM -Dkey=value or directly Unix env variables ? When I talk about system variables, it's -D args to the JVM. The later is env variable. Regards JB On 04/13/2015 01:17 PM, CLEMENT Jean-Philippe wrote: > Hi JB, > > We did try with ext but it did not work: ${TOTO} to retrieve the $TOTO variable. > > What is the naming convention? > > JP > > [@@ OPEN @@] > > > -----Message d'origine----- > De : Jean-Baptiste Onofré [mailto:[email protected]<mailto:[email protected]> <mailto:[email protected]<mailto:[email protected]>>] Envoyé : lundi 13 > avril 2015 10:28 À : [email protected]<mailto:[email protected]> <mailto:[email protected]<mailto:[email protected]>> Objet : Re: Environment > variables and Blueprint > > Hi JP, > > you can use Aries blueprint-ext and directly use ${} where the key is the system variable. > > Regards > JB > > On 04/13/2015 10:14 AM, CLEMENT Jean-Philippe wrote: >> Dear Karaf-ers, >> >> I would like to retrieve environment variables via Blueprint. >> Placeholder “persistent-id” is mandatory so it must point to a >> .properties file, so maybe it’s not through cm-placeholders. >> >> Also, is there a way to replace expressions in .properties files? >> >> Regards, >> >> JP >> >> [@@ OPEN @@] >> > > -- > Jean-Baptiste Onofré > [email protected]<mailto:[email protected]> <mailto:[email protected]<mailto:[email protected]>> > http://blog.nanthrax.net > Talend - http://www.talend.com > -- Jean-Baptiste Onofré [email protected]<mailto:[email protected]> <mailto:[email protected]<mailto:[email protected]>> http://blog.nanthrax.net Talend - http://www.talend.com -- Charlie Mordant Full OSGI/EE stack made with Karaf: https://github.com/OsgiliathEnterprise/net.osgiliath.parent -- Jean-Baptiste Onofré [email protected]<mailto:[email protected]> http://blog.nanthrax.net Talend - http://www.talend.com
