Configuring a target environment
It is often the case that one wants to use different configuration values for different environments. For example in the case of
a contact form one wants to use a different email address for developement/testing than for production.
The following resource configuration example
src/realms/yanel-website/res-configs-repo/data/en/contact.html.yanel-rc
has set the email address twice:
<yanel:property name="to" value="contact@wyona.com"/> <yanel:property name="to" value="michael.wechner@wyona.com" target-environment="dev"/>Once for the default (by convention the production environment) and once for the development environment.
IMPORTANT: Because the 'target environment' functionality has been introduced at some later stage, one needs to increase the version number of the particular resource configuration XML from 1.0 to 1.1 or higher, e.g.
<yanel:resource-config xmlns:yanel="http://www.wyona.org/yanel/rti/1.1">
The environment of a Yanel instance can be configured inside
WEB-INF/classes/yanel.xml
by setting for example
<target-environment>dev</target-environment>Please note that the build process (from source) might overwrite this configuration unless set inside
YANEL_HOME/conf/local/local.yanel.xml
which is based on the configuration template
YANEL_HOME/conf/yanel.xml
One is free to choose the name of a target environment, but it's recommended to use the below names by convention:
- prod = production
- ua-test = user acceptance test
- ci-test = continuous integration test
- dev = development
Configurations supporting the target-environment attribute
The following configuration types are currently supporting the target-environment attribute:
- Resource configuration (see for example
src/realms/yanel-website/res-configs-repo/data/en/contact.html.yanel-rc
) - Realm configuration (see for example
src/realms/from-scratch-realm-template/realm.xml
) - Workflow configuration (see for example src/realms/from-scratch-realm-template/data-repo/data/app1/workflow/workflow-with-review.xml)
- Scheduler configuration (see for example src/realms/from-scratch-realm-template/data-repo/data/scheduler-jobs.xml)
Please let us know if you think other configurations should also support the target-environment
attribute.
Your comments are much appreciated
Is the content of this page unclear or you think it could be improved? Please add a comment and we will try to improve it accordingly.