How to use Sapho environment variables placeholders

Last update:

Audience: Developers building Sapho micro apps

One of the key elements of any type of software development is development workflow. We understand that for proper development, multiple environments are needed, therefore as of Sapho Modern Portal 5.0 we support configuration placeholders that are replaced with environment variables values in runtime. This provides the ability to keep the same configuration in different Sapho Modern Portal instances but have different configurations in environment variables for each environment.

The advantage of this approach is that moving the Sapho Modern Portal across environments does not override environment-specific configuration.

Sapho Modern Portal supports a placeholder convention for environment variables {{env "env-variable-name"}} that you can use to reference server environment variables for configuration settings in Sapho Builder.

Imagine you want to integrate SAP Concur expense management into Sapho Modern Portal and you are have 3 different SAP Concur instances. The first is a development sandbox, the second is a pre-production staging environment, and the last one is the production environment.

In all the environments where Sapho Modern Portal is running, you need to set certain environment variables e.g.:

Sapho Development Environment


Sapho Staging Environment


Sapho Production Environment



Do not forget to restart Tomcat server after setting the environment variables.

When creating the SAP Concur data integration on the development environment, you can fill in the configuration dialog with environment variable placeholders. 

Instance URL: {{env "SAPHO_CONCUR_URL"}}
Username: {{env "SAPHO_CONCUR_USERNAME"}}
Password: {{env "SAPHO_CONCUR_PASSWORD"}}
Consumer Key: {{env "SAPHO_CONCUR_CONSUMER_KEY"}}


Use unhide icon for entering masked fields as passwords or keys.


Now you can clone Sapho Modern Portal from the development environment to the staging environment by dumping and importing the sapho database schema as described in How to upgrade a Sapho on premises Server. The placeholder variables will take the values of the environment variables on staging so there is no need to change the configuration.

Apart from using environment variables placeholders for data integration configuration, you can use them for all other configuration options in Sapho Modern Portal Builder as well, e.g. identity provider configuration, mobile notification configuration, endpoint notification configuration, messenger configuration, etc.