Environment Variables (Magic xpi 3.x)
Environment variables are used for defining the external IT environment properties inside a Magic xpi project. You can create environment variables to use in place of an actual file name, allowing the smooth portability of flows from the development environment to the deployment environment.
Environment variables do this by creating variables for flow elements without an explicit relation to the physical storage media or operating system naming conventions where they are located. For example, you can assign an environment variable to a database. You then use the environment variable instead of the actual name when you enter the database information in the appropriate Magic xpi dialog box.
Magic xpi achieves portability by translating the environment variables at runtime, according to the values entered in the Environment Variables Repository. These values are automatically entered into one of the Magic xpi configuration files. However, although the environment variables translation can be changed at runtime, they are mostly used as constants.
Environment variables can be used within other environment variables (nested environment variables). For example, you can have the currentprojectdir environment variable include the projects and sl environment variables as part of its translation, and the projects environment variable include the Magic xpi environment variable as part of its translation (project = %Magicxpi%projects%sl%).
Best Practices
|
|
Use environment variables explicitly only when dynamic behavior is required and expressions cannot be used.
|
Environment variables allow you to easily move from the Magic xpi Suite's Windows-based development environment to a Unix, Linux, or System i deployment environment, using only the Magic xpi Server. This is because:
-
Environment variables can be changed in the configuration file after you deploy on the Magic xpi Server. This allows you to easily make changes to names of elements after you leave the development environment. For example, if you use a database in the development environment called Management and the name of the same database in the deployment environment is called Managers, the Magic xpi Server must be able to recognize the new name. If you use an environment variable, you can change the value in the configuration file in the Server environment. For example, you can create an environment variable called Manage in the Resource Repository. If you enter the value for this as Management, it is entered in the configuration file as Manage=Management. When you deploy the project, change the configuration file entry to Manage=Managers and the Magic xpi Server will recognize the new database name.
-
Environment variables can be used to create names and file paths that are recognized in both a Windows® environment and a Unix, Linux, or IBM i environment. For example, Magic xpi contains a standard environment variable called SL. This name translates to a forward or backward slash. When you replace all backslashes with this environment variable, you can deploy a project on a Unix, Linux, or IBM i machine without having to change the backslashes to forward slashes.
The Environment Variables Repository lets you easily assign environment variables, which are used instead of a flow element's actual name. You can assign environment variables to databases, files, folders, and most other elements used in your integration flows.
Environment variables are stored in the current resource file.
Working in a multiple project environment has implications for environment variable definitions. If you define environment variables for the project, you should click the Save button each time you make changes in the Environment Variables Repository. This opens the Save ini dialog box, where you should enter the name and location of the ifs.ini file for the project (in the project folder). The default file is the ifs.ini file for the current project.
Environment Variables List
Deployment