STUDIO Visual Editor
-
Define a list of environments you wish to support in your application. For example, one common use case involves configuring the application to support both Production and a QA environments.
-
Right-click the
src/main/resources
folder, then select New > File to create a properties file for each environment you wish to support. For example:-
qa.properties
-
production.properties
-
-
Double-click each of these new files to open them in new tabs in Studio. By editing hem, you can configure the properties of the environment that correspond to the filename. For example, in
production.properties
, you may wish to add the properties as per the image below. Keep in mind that you can use these properties anywhere in your application.Learn how to encrypt a properties file using the Mule Credentials Vault.
-
Close the properties files.
-
Click in the Global Elements tab of your Studio project, below the canvas.
-
Create a new global element. When selecting the element type, pick Property Placeholder under Component Configurations.
-
Set the value of the Location field to
${mule.env}.properties
Learn more about configuring variable properties.
-
To configure Studio to use a specific environment when deploying on-premise , debugging or using DataSense to retrieve metadata from a SaaS provider, double-click to open your application’s
mule-project.xml
file, located in the root directory of your project.If you deploy your application to the cloud, in Studio select Deploy to Anypoint Platform → Cloud. Studio allows you to specify your environment variables prior to deployment, effectively enabling you to choose your deployment environment at runtime.
-
Add an environment variable named
mule.env
with a value that matches the environment to which you wish to deploy by default (in the image below, the value isqa
). -
Close the
mule-project.xml
file, then save your application. When you debug your application or deploy it on-premise, Studio deploys to the environment you specified in themule-project.xml
file. -
To change the default deployment environment at any time, change the value of the environment variable key. For example, to deploy to a test environment – assuming you have a
test.properties
file in your application– change the value totest
.
XML Editor
-
Define a list of environments you wish to support in your application. For example, one common use case involves configuring the application to support both Production and a QA environments.
-
Right-click the
src/main/resources
folder, then select New > File to create a properties file for each environment you wish to support. For example:-
qa.properties
-
production.properties
-
-
Double-click each of these new files to open them in new tabs in Studio. By editing hem, you can configure the properties of the environment that correspond to the filename. For example, in
production.properties
, you may wish to add the properties as per the image below. Keep in mind that you can use these properties anywhere in your application.Learn how to encrypt a properties file using the Mule Credentials Vault.
-
Close the properties files.
-
At the top of your XML config, above all other flows, add a <context: property-placeholder/> element with a
resources
attribute configured as per below.<context:property-placeholder resources="$mule.env.properties"/>
Learn more about configuring variable properties.
-
To configure Studio to use a specific environment when deploying on-premise , debugging or using DataSense to retrieve metadata from a SaaS provider, double-click to open your application’s
mule-project.xml
file, located in the root directory of your project.If you deploy your application to the cloud, right click on your project in the package explorer and select Deploy to Anypoint Platform → Cloud. Studio allows you to specify your environment variables prior to deployment, effectively enabling you to choose your deployment environment at runtime.
-
Add an environment variable named
mule.env
with a value that matches the environment to which you wish to deploy by default (in the image below, the value isqa
). -
Close the
mule-project.xml
file, then save your application. When you debug your application or deploy it on-premise, Studio deploys to the environment you specified in themule-project.xml
file. -
To change the default deployment environment at any time, change the value of the environment variable key. For example, to deploy to a test environment – assuming you have a
test.properties
file in your application– change the value totest
.