Environment Identifiers

When installing Maconomy, it is often necessary to easily distinguish between different environments. The typical example is when two different environments, Production and Test, are set up side by side. The web client offers a facility to decorate the top navigation bar with a title, foreground color and background color.

Simple Example

In the listing below, the title is either 'PRODUCTION' or 'TEST' depending on whether the shortname is 'prod' or not. Similarly the colors are also dynamic to further emphasize the difference between these two environments. This code should be added to the bindings section of the couplingconfiguration.mcsl.xmlon the Maconomy server. It can be edited via the Maconomy Extender.

<Binding namespace="client:menudock">
  <Fields>
    <Field name="title" valueString="^{if shortname() = 'prod' then 'PRODUCTION' else 'TEST'}"/>
  </Fields>
</Binding>
<Binding namespace="client:menudock:web">
  <Fields>
    <Field name="backgroundcolor" valueString="^{if shortname() = 'prod' then 'Green' else 'Red'}"/>
    <Field name="foregroundcolor" valueString="White"/>
  </Fields>
</Binding>

This results in the following red test banner in the top of the web client when running on the test shortname.

Formats and Language

More than 2 Environments

To distinguish between three different environments, PROD, TEST and DEV, the code listing can be refined with an even more elaborate conditional as seen below.

<Binding namespace="client:menudock">
  <Fields>
    <Field name="title" valueString="^{if shortname() = 'prod' then 'PRODUCTION' else (if shortname() = 'test' then 'TEST' else 'DEV')}"/>
  </Fields>
</Binding>
<Binding namespace="client:menudock:web">
  <Fields>
    <Field name="backgroundcolor" valueString="^{if shortname() = 'prod' then 'Green' else (if shortname() = 'test' then 'Red' else 'Purple')}"/>
    <Field name="foregroundcolor" valueString="White"/>
  </Fields>
</Binding>