How do I use environment variables in an attribute name in jboss' standalone.xml?

Discussão em 'StackOverflow' iniciado por Stack, Janeiro 24, 2021.

  1. Stack

    Stack Membro Participativo

    I understand that within a field, I can pull an environment variable with the syntax of ${env.VARIABLE_NAME}, however, whenever I try to do so within an attribute name, jboss throws an error.

    What I have done, and works

    <datasource jndi-name="java:/jdbc/database" pool-name="database" enabled="true" use-java-context="true">
    <connection-url>${env.DS_CONNECTION_URL}</connection-url>
    <driver>${env.DS_DRIVER}</driver>
    </datasource>


    What I want to do, which is failing

    <console-handler name="CONSOLE">
    <formatter>
    <named-formatter name="${env.FORMATTER}"/>
    </formatter>
    </console-handler>


    I have also tried starting without the surrounding quotes. I have created a child xml element with the value of name and the environment variable, but that has also failed.

    I expect the environment variable FORMATTER to be used as the name, but instead I get the following error on attempting to start jboss.

    java.lang.IllegalArgumentException: Formatter "${env.FORMATTER}" is not found

    Continue reading...

Compartilhe esta Página