Search code examples
javawildflyvirtual-hostssystem-propertiesundertow

Wildfly 8.2/Undertow - properties placeholder does not seem to work for alias attribute in host configuration


I'm trying to generalize Wildfly (8.2 Final) XML configuration in order to have a single configuration XML file with references of system properties (${what.ever.value.key.from.proerties}) in order to distinguish dev. and prod. env. by different .properties-files.

Worked fine till I've rich the undertow subsystem. When I try to reference value from property for the alias attribute of vertual host configuration - it doesn't seem to recognize and resolve at this position the key with value from .properties.

A small snippet of Wildfly XML configuration to show what I mean exactly:

<subsystem xmlns="urn:jboss:domain:undertow:1.2">
    ...
    <server name="default-server">
        ...
        <host name="default-host" alias="${undertow.virtual.host.alias.mydomain}">
            ...
        </host>
    </server>
    ...
</subsystem>

And corresponding entries in dev.properties file:

undertow.virtual.host.alias.mydomain=localhost

and in prod.properties file:

undertow.virtual.host.alias.mydomain=www.mydomain.com

The value of the key 'undertow.virtual.host.alias.mydomain' will not be substituted. What do I do wrong here? Or such functionality does not support for alias attribute?

Thanks in advance!


Solution

  • That attribute doesn't:

    "alias" => {
        "type" => LIST,
        "description" => "Aliases for the host",
        "expressions-allowed" => false,
        "nillable" => true,
        "value-type" => STRING,
        "access-type" => "read-write",
        "storage" => "configuration",
        "restart-required" => "all-services"
    }
    

    You can use the read-resource-description operation to see if expressions are allowed. For example /subsystem=undertow/server=default-server/host=default-host:read-resource-description for this resource.

    You could also look at the wildscribe site which should have most versions available.