---
title: Environments
description: >-
  Learn how Datadog Feature Flags environments isolate flag configuration across
  deployment stages.
breadcrumbs: Docs > Feature Flags > Concepts > Environments
---

# Environments

{% callout %}
# Important note for users on the following Datadog sites: app.ddog-gov.com, us2.ddog-gov.com

{% alert level="danger" %}
This product is not supported for your selected [Datadog site](https://docs.datadoghq.com/getting_started/site.md). ({% placeholder "user-datadog-site-name" /%}).
{% /alert %}

{% /callout %}

## Overview{% #overview %}

Environments represent different deployment stages or modes in your software delivery life cycle, such as Development, Staging, and Production. Flag configuration is isolated by environment. A flag can be enabled, disabled, overridden, or given targeting rules in one environment without affecting other environments.

## Manage environments{% #manage-environments %}

Manage environments from **Feature Flags > Settings > Environments**:

{% image
   source="https://docs.dd-static.net/images/getting_started/feature_flags/environments-list.cd9670523869c056142c94452c411b60.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/getting_started/feature_flags/environments-list.cd9670523869c056142c94452c411b60.png?auto=format&fit=max&w=850&dpr=2 2x"
   alt="Environments list in Feature Flags settings." /%}

### Add an environment{% #add-an-environment %}

1. Navigate to [**Feature Flags > Settings > Environments**](https://app.datadoghq.com/feature-flags/settings/environments).
1. Click **Create Environment**.
1. Configure the environment name, queries, and whether it is a production environment.

### Edit an environment{% #edit-an-environment %}

1. Navigate to [**Feature Flags > Settings > Environments**](https://app.datadoghq.com/feature-flags/settings/environments).
1. Click the environment you want to edit.
1. Update the environment settings and save.

### Delete an environment{% #delete-an-environment %}

1. Navigate to [**Feature Flags > Settings > Environments**](https://app.datadoghq.com/feature-flags/settings/environments).
1. Hover over the environment you want to delete, then click the trash icon.

## Default environments{% #default-environments %}

By default, Datadog creates three environments for your organization:

- **Development**
- **Staging**
- **Production**

You can modify these environments or add new ones to match how your team deploys code.

## Production environments{% #production-environments %}

Mark an environment as **production** to indicate that changes in that environment can affect customers. Production environments support additional governance controls, such as required change approvals.

## Environment queries{% #environment-queries %}

Each environment is configured with a **name** and a set of **queries**. Queries are the `env` or `DD_ENV` strings your applications send at runtime.

Having multiple queries per environment lets you keep the `env` value consistent with the environment you pass to RUM, APM, or StatsD. For example, you might have `staging-eu` and `staging-us` as separate `env` values in your telemetry, but map both to a single **Staging** environment in Feature Flags. That way, you do not need to duplicate flag configuration across multiple Staging environments when you want to enable a flag across all of Staging.

## Connect environments in the SDK{% #connect-environments-in-the-sdk %}

The `env` value you use must match a query configured for the Feature Flags environment you want, such as `staging-us` or `production`. If you already set `env` or `DD_ENV` for RUM, APM, or tracing, use the *same value* for Feature Flags.

### Client-side applications{% #client-side-applications %}

Set `env` when you initialize the Datadog OpenFeature provider (same value as RUM):

```javascript
import { DatadogProvider } from '@datadog/openfeature-browser';
import { OpenFeature } from '@openfeature/web-sdk';

const provider = new DatadogProvider({
  clientToken: '<CLIENT_TOKEN>',
  applicationId: '<APPLICATION_ID>',
  site: 'datadoghq.com',
  env: 'staging-us', // Must match an environment query in Feature Flags
  service: '<SERVICE_NAME>',
  version: '1.0.0',
});

await OpenFeature.setProviderAndWait(provider);
```

### Server-side applications{% #server-side-applications %}

Set `DD_ENV` in your deployment environment (shell, container, or orchestrator), not in application code:

```bash
export DD_ENV=staging-us  # Must match an environment query in Feature Flags
export DD_SERVICE=<YOUR_SERVICE_NAME>
export DD_EXPERIMENTAL_FLAGGING_PROVIDER_ENABLED=true
```

This applies to Python, Go, Java, Node.js, Ruby, and .NET server SDKs. See [Server-Side Feature Flags](https://docs.datadoghq.com/feature_flags/server.md) for language-specific setup.

## Further reading{% #further-reading %}

- [Getting Started with Feature Flags](https://docs.datadoghq.com/getting_started/feature_flags.md)
- [Variants and Flag Types](https://docs.datadoghq.com/feature_flags/concepts/variants_and_flag_types.md)
- [Targeting Rules and Filters](https://docs.datadoghq.com/feature_flags/concepts/targeting_rules.md)
