Skip to content

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

Function: setEnvVar() ​

setEnvVar(options, auth): Promise<void>

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

Sets an environment variable on a project environment.

Creates the variable if it doesn't exist, or updates it if it does.

Parameters ​

options ​

SetEnvVarOptions

Options specifying project, environment, and variable

auth ​

AuthStrategy

Authentication strategy (ApiKeyStrategy)

Returns ​

Promise<void>

Throws ​

Error if request fails

Example ​

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

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

await setEnvVar({
  projectSlug: 'my-storefront',
  environment: 'production',
  key: 'API_KEY',
  value: 'secret-value'
}, auth);

Released under the Apache-2.0 License.