Property types¶
In addition to your standard text properties, it is possible to create properties with other types for special cases.
File properties¶
One of the greatest limitations of property placeholders is that it cannot be used to inject files. This is a major issue especially since inject keystores is a very common requirements in mule applications.
In order to solve this, this placeholder provides support for file injection. This can be used by setting the type to file
, and then setting
as a value use the file content base64 encoded. ie:
The content will be written to a file, and the file path of that file will be set as the property id appended with .file
.
So the above example will write "hello world" (which base64 encoded is aGVsbG8gd29ybGQ=
) to a file, and the path to that file assigned as
the property my.cert.file
URL properties¶
By setting type to url
, it will parse the property as an URL and generate addition properties:
Property | Description |
---|---|
[key] .scheme |
will be assigned with the URL scheme |
[key] .host |
will be assigned with the URL host |
[key] .port |
will be assigned with the URL port |
[key] .path |
will be assigned with the URL path |
so for example the following:
will result in the following properties:
Key | Value |
---|---|
test | http://www.be.com/foo |
test.scheme | http |
test.host | www.be.com |
test.port | 80 |
test.path | /foo |
Self Signed Cert properties¶
By assigning the property type of sscert
, this automatically generate a self-signed certificate, using the
provided property value as it's DN (if not set, will default to CN=api
)
The certificate and private key will be stored in a keystore, and the following property will be assigned:
Property | Description |
---|---|
[key] .file |
Keystore file path |
[key] .storepw |
Keystore password |
[key] .keypw |
Keystore password |
[key] .alias |
Key alias |
ie:
HTTP Listener properties¶
This is a convenience property type https
that generates various properties required to setup an HTTPS listener. The property
values provided will be used for the certificate DN just like for the sscert
property types.
Additionally, it supports the following fields:
internal
: boolean that indicates if an internal port should be used rather than external port.
The following properties are generated by this property definition:
[key].port
:8092
unlessinternal
is set to true in which case it will set8082
[key].host
:0.0.0.0
[key].ks.file
: Keystore file path[key].ks.storepw
: Keystore password[key].ks.keypw
: Keystore password[key].ks.alias
: Key alias
Please note that [key].port
and [key].host
can both be overriden using system properties.
ie:
will result in the following properties:
listener.http.port=8082
listener.http.host=0.0.0.0
listener.http.ks.file=/tmp/certkeystore.jks
listener.http.ks.storepw=flik2u3r98saflj
listener.http.ks.keypw=f32jadslf8ow3
listener.http.ks.aslias=selfsigned
The self-signed certificate will use the dn CN=api.example.com
In order to use those properties (assuming you're using the property http.listener
) with your HTTP listener, just replace your http:listener-connection
(inside http:listener-config
) with:
<http:listener-connection host="${http.listener.host}" port="${http.listener.port}" protocol="HTTPS">
<tls:context >
<tls:key-store type="jks" path="${http.listener.ks.file}" alias="${http.listener.ks.alias}" keyPassword="${http.listener.ks.keypw}" password="${http.listener.ks.storepw}" />
</tls:context>
</http:listener-connection>
Group properties¶
A property defined with the group
type cannot define any values, and instead will have the following field:
- properties: This will contain an array of properties
This field will be prefixed with the group property key. For example, the following
will result in the following two properties being defined: