Skip to content

@salesforce/b2c-tooling-sdk / operations/mrt / createEnv

Function: createEnv() ​

createEnv(options, auth): Promise<{ }>

Defined in: packages/b2c-tooling-sdk/src/operations/mrt/env.ts:139

Creates a new environment (target) in an MRT project.

Parameters ​

options ​

CreateEnvOptions

Environment creation options

auth ​

AuthStrategy

Authentication strategy (ApiKeyStrategy)

Returns ​

Promise<{ }>

The full environment object from the API

Throws ​

Error if creation fails

Example ​

typescript
import { ApiKeyStrategy } from '@salesforce/b2c-tooling-sdk/auth';
import { createEnv } from '@salesforce/b2c-tooling-sdk/operations/mrt';

const auth = new ApiKeyStrategy(process.env.MRT_API_KEY!, 'Authorization');

const env = await createEnv({
  projectSlug: 'my-storefront',
  slug: 'staging',
  name: 'Staging Environment',
  region: 'us-east-1',
  isProduction: false
}, auth);

console.log(`Environment ${env.slug} created`);

Released under the Apache-2.0 License.