1

We use Wildfly 9.0.2 server and we need to use custom property resolver to inject values to system-properties in standalone.xml, to make something like:

  <system-properties>
    <property name="my-property" value="${custom:property-value-key}" />
  </system-properties>

Is there mechanism similar to the one provided by Tomcat (org.apache.tomcat.util.digester.PROPERTY_SOURCE property)?

Thank you!

Dmitry
  • 1,056
  • 1
  • 8
  • 17
  • 1
    As far as I know this is not possible. But if you specify what you exactly want to do I maybe can help with a suitable solution. – Simon Martinelli Nov 18 '16 at 15:45
  • We need to configure datasource with information from Consul and Vault – Dmitry Nov 18 '16 at 15:55
  • 2
    If you need a dynamic datasource configuration use environment variables that you set before starting WildFly you can access these like this: ${env.QLEO_DB_URL} – Simon Martinelli Nov 18 '16 at 15:58
  • I would prefer to avoid using environment variables, since someone needs to set them – Dmitry Nov 18 '16 at 15:59
  • 1
    Sure but where would ${custom:property-value-key} come from? – Simon Martinelli Nov 18 '16 at 16:00
  • If I will be able to use custom property resolver, I can retrieve it's value from any external service. We use the same mechanism for Tomcat, and I wonder if there is a similar way to do it in Wildfly – Dmitry Nov 18 '16 at 16:02
  • Stupid question again. And why do you need it as system property? Because when it is a datasource you have to set it in standalone.xml – Simon Martinelli Nov 18 '16 at 16:03
  • It not have to be system property - I just need a way to provide custom expression resolver... – Dmitry Nov 18 '16 at 16:05
  • 1
    Have a look at http://deltaspike.apache.org/documentation/configuration.html There you can implement your own ConfigSource http://deltaspike.apache.org/documentation/configuration.html#CustomConfigSources – Simon Martinelli Nov 18 '16 at 16:07
  • 1
    Maybe Custom Vault implementation is a way to do it? https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6.4/html/Security_Guide/Configure_JBoss_EAP_6_to_Use_a_Custom_Implementation_of_the_Password_Vault.html Of course you have to follow VAULT format ${VAULT::valt_block::attribute::}, but in your implementation you can have your "custom" prefix in vault_block... – Vadim Nov 18 '16 at 20:00

1 Answers1

0

Since there is no easy programmatic way to inject custom properties to standalone.xml, we decided to modify startup sh scripts to read data from Consul and set environment variables to WIldfly process and then read them as ${env.QLEO_DB_URL} in standalone.xml.

Dmitry
  • 1,056
  • 1
  • 8
  • 17