Table of contents

Official Content

In various scenarios, it is common practice to read configuration information from environment variables, rather than configuration files. This document details how to do this practice in Cloud Services properties.

For instance, if you configured your application to use Microsoft Azure as your Storage Provider, you will have to set some properties like the account details and container names. These properties can also be modified at runtime via environment variables. These variables must be also prefixed with 'GX_' and must contain the type of the service and the name of the property, all in capital letters. So, if you want to modify the Public Container Name, you can create a variable called GX_STORAGE_PUBLIC_CONTAINER_NAME with the value of your choice. For further reference of the Types and property names, you can open the generated CloudServices.config file.

Property redirection

There are cloud providers that already provide environment variables with the values to connect to the different services.
If the provider does not provide environment variables for the purpose, you can define your own.

In any case, to use those variables, a specific file allows you to declare the mapping between the environment variables defined at the cloud provider and the configuration property. This file is called confmapping.json and contains a json octopus (property value) with the necessary mapping.

Java Example

Amazon provides the environment variables RDS_USERNAME and RDS_PASSWORD (among others) where the corresponding values of the RDS are already loaded. For that case, you can have the file confmapping.json in the WEB-INF directory of your web app with the following json:


When the web app wants to raise the USER_ID property of the com.environmenttest |DEFAULT section, it will read the value of the RDS_USERNAME environment property (and the same with the USER_PASSWORD / RDS_PASSWORD). 

.NET or .NET Framework Examples

In the case of .NET, and .NET Framework, the confmapping.json should be like the following (where XXX and YYY are variables defined in the Cloud provider).


Note: To test what value is being taken into account or what environment variables are set, you may use ConfigurationManager external object.

See Also

Application Configuration using Environment Variables
Application Configuration using Environment Variables in .NET and Java
HowTo: Deploy an Application to Docker


Last update: November 2023 | © GeneXus. All rights reserved. GeneXus Powered by Globant