2 Replies Latest reply on Feb 2, 2016 2:05 PM by Michael Davis

    Configuring a datasource in Wildfly using environment variables for Docker

    Michael Davis Newbie

      Hi,

       

      I'm preparing to get our Wildfly applications running on Docker. I'm stuck on one thing though.

       

      I've got a mysql datasource configued in a customized version of standalone.xml. I'm trying to figure out how to reconfigure it to take the parameters:

       

      database server

      database name

      database username

      database password

       

      from environment variables. It would be lovely If I could write, in standalone.xml, something like:

       

      <connection-url>${env:DB_CONNECTION_URL}</connection-url>

       

      Now, a certain Marek Goldman has published some solutions to this here:

       

      https://goldmann.pl/blog/2014/07/23/customizing-the-configuration-of-the-wildfly-docker-image/

       

      The one that seems best is configuring the datasource using a cli script after wildfly is running, but that seems like a kludge.

       

      There must be a better way! Maybe there's some magic syntax in the wildfly config files that I'm not aware of, that lets you reference environment variables?

       

      thanks

      Michael Davis

      Ottawa