Environment Profiles
Build in staging, deploy to production just like your own development process
Environments can be used in Superblocks to:
- Connect a Production and Staging version of any Integration (for example, Postgres)
- Develop Applications, Workflows or Scheduled Jobs against Staging or Production Integrations
- Deploy Applications, Workflows or Scheduled Jobs and target Staging or Production Integrations
This enables developers to their apps and follow a standard software development lifecycle, but with additional flexibility.
On this page:
Setup Integration
To create an Integration, navigate to the Integrations
page from the left navigation bar of the Superblocks home page, and then select the desired Integration type from the available ones.
Once you fill out the form for an Integration and click Create Integration
, you'll have the option to either edit the configuration for each environment or continue with the same configuration for both environments.
If you choose to keep the environments the same or navigate away, you can always access them again from the Integrations
section in the left navigation bar from the home page. Once you click the desired integration (or when you select Edit environments
after initial creation), you'll now see two tabs in the Integration form.
Switching between environments
All Superblocks Applications, Workflows and Scheduled Jobs now have an environment selector in the header in edit and preview modes. This selector can be used to switch between Production and Staging Integrations while developing on Superblocks.
The environment selection can be switched by either using the dropdown in the headers in edit mode (and preview mode for Applications), or by specifying a query param in the Superblocks Application/Workflow/Scheduled Job URL (?environment=staging
or ?environment=production
).
In the deployed mode of an Application, there is no environment dropdown in the header, and the environment can only be switched using the query param. Similarly, you can use the query param to specify which environment to use when calling the headless Workflow URL displayed on the Workflow setup page.
Applications/Workflows/Jobs use the Production environment by default in deployed mode and Staging environment by default in edit or preview mode.
Referencing current environment in code
You can reference the current environment using the Javascript (_.get(Global.URL.queryParams, "environment")
) and Python (Global.URL.queryParams.environment
) API steps. See below for code examples on how to do this. Please note, you'll need to update the console.log()
and print()
statements with the associated steps you'd like to complete.
Javascript code snippet:
enviro = _.get(Global.URL.queryParams, "environment")
console.log(enviro)
if (enviro == "production") {
console.log("You're currently in the production environment.");
} else if (enviro == "staging") {
console.log("You're currently in the staging environment.");
} else {
console.log("Throw an error, this line should never run.");
}
Python code snippet:
enviro = Global.URL.queryParams.environment
print(enviro)
if enviro == "production":
print("You're currently in the production environment.")
elif enviro == "staging":
print("You're currently in the staging environment.")
else:
print("Throw an error, this line should never run.")