I have some configuration templates which use FMPP to generate the real runtime config files based upon info in a csv and properties file (defined in config.fmpp).
I want to be able to configure a second cluster server for the same task using the same set of templates and config.fmpp information. However, there are slight differences needed in the generated runtime config and I can do this if I know which server instance I am on ("serverA" or "serverB") using a standard fmpp variable like ${myserver}.
But there must only be one set of templates and FMPP config files so I need to somehow get the value of "myserver" from the runtime environment in each server.
Some of the options I might have are:
- pass value of myserver on the command line tool invocation (best way); or
- get it from an environment variable.
Does anyone have an example of the code to do any of these and any suggestions of the best approach? Online reference would be great.
fmpp -S /home/me/sample-project/src -Param myserver:serverA
Environment settings:
- fmpp v0.9.14
- freemarker v2.3.19
Use the
-Dcommand line option (see--help):Like:
Note that there's a space after the
-D. (It's not like the java command line syntax, but rather like the standard GNU command line syntax.The documentation shows
onLine:true, but such Boolean values are legacy and no longer accepted. Useonline:yesto parse Boolean values.For example:
Then, within the template:
Will result in:
The
--verbosecommand-line parameter is useful to show any errors when parsing the template.