Defining resource names with environment variables

You can avoid customizing resource name and configuration files for specific deployments by defining resources as operating system environment variables. At run time, the Resource Registry $GETENV() function resolves resource aliases that are defined as environment variables. The $GETENV() function can be used with or without Resource Registry encryption.

  1. Use an operating system environment variable to define the resource. For example, on a Microsoft Windows system, use Control Panel > System > Advanced system settings > Advanced > Environment Variables. The environment variable might be case-sensitive, depending on the operating system.
  2. In the Resource Registry resource name (.mrn) file, specify the Resource Value as $GETENV(env_var) where env_var is the environment variable name. The string must not contain any spaces. The $GETENV() function is not case sensitive.

    If the specified environment variable is not defined, the $GETENV() function resolves to an empty (zero-byte) string.

An informational log file message like the following indicates environment variable usage. For example:
DTXLN2154I - Fri Feb 10 07:32:21 2017 - tid: 12068 inst: -1 - Resource Registry Info : Alias [username] uses environment variable [USERNAME] (mresname.c:1243)