In this article, you will learn
- How to automatically map connector queries to test and development environments
When you are testing your connector functions in "Development" mode of an app, you may not want to make updates to your production database or another source of truth.
For example, let's say you are using the Tulip Player on your computer to test a trigger that runs a connector function with a POST request. You may not want to be adding test data to your production database.
Instead, you may want to run the connector function with a test database. You can use "Environments" in Tulip to accomplish this.
Environments allow you to run the same connector functions on different databases/services, depending on the status of the app.
In other words, when you run an app in "development mode", a connector function will automatically run on your testing or development environment.
Here's how to configure environments.
Setting Up Multiple Environments
After you create a new SQL or HTTP connector, you will see a screen like this.
By default, "1 connection" will be selected, which means that connector functions in all app versions will connect with the same server.
But, if you want to run connector functions in multiple environments, select "2 connections". You will now have the opportunity to add details about 2 separate servers.
Use "Add Connection Details" to add details about each server.
Let's imagine that you are running the following Connector function in an app:
Here would be the sequence of events:
- Administrator or operator opens the step in the app, which triggers the "New Connector Function" trigger
- In the "Then" statement, you are specifying that the "Get_Configuration" function will run on the "Server Assembly DB" connector with the input of text "test".
- IF the app is in "development mode" when the step is opened, then the function will run on the server connected to the Testing/Development environment. If the step is opened in a published version of the app, the function will run on the server connected to the Production environment.
Using Environments with Approvals
So far, we have discussed two separate environments. But, if you have the Approvals feature in your account, there will be an option to specify three environments: production, testing and development.
In this case, the "testing" environment will be used when the app is in the "Awaiting Approval" state.