Skip to main content

Product Environments

A Product Environment in Ductape defines a context (such as development, staging, or production) in which your product runs. Environments let you manage different settings, credentials, and integrations for each context, ensuring your product works smoothly everywhere.

Environment Structure

FieldTypeRequiredDescriptionExample
env_namestringYesName of the environmentDevelopment
slugstringYesUnique 3-letter identifier for the environment (lowercase)dev
descriptionstringNoBrief description of the environmentDev environment
activebooleanYesWhether the environment is activetrue
envsarrayNoApp environment mappings (see app docs)
authobjectNoAuthentication config for the environment

Creating a Product Environment

To set up a new environment, use the create function on the product.environments instance.

Example:

const environment = await ductape.product.environments.create({
env_name: "Development",
slug: "dev",
description: "Development environment"
});

Updating a Product Environment

To update an existing environment, specify the slug and the new details.

Example:

const updatedEnvironment = await ductape.product.environments.update("prd", {
env_name: "Production",
description: "Production environment"
});

Fetching Environments

You can retrieve all environments for your product or fetch a specific one by its slug.

Fetch All:

const environments = await ductape.product.environments.fetchAll();

Fetch One:

const environment = await ductape.product.environments.fetch("prd");

Why Use Environments?

  • Separate development, staging, and production settings
  • Safely test changes before deploying to production
  • Manage credentials and integrations for each context

Next Steps