commercetools configuration
Your service's config class extends CommercetoolsConfig with its own variables and loads it once at startup. Loading fails and names the variable when a required one is missing. A secret is removed from process.env once it is read.
import { type EnviConfig, envfield } from "@evolve-framework/config";import { CommercetoolsConfig } from "@evolve-framework/commercetools";
class Config extends CommercetoolsConfig { readonly HTTP_PORT = 8080;
config(): EnviConfig { return { ...super.config(), HTTP_PORT: envfield.number() }; }}
export const config = new Config();await config.load();CommercetoolsConfig
The commercetools project a service talks to, and the API clients it uses: one for the service itself, and one for the anonymous and customer tokens a storefront's shoppers get. Extend it with the service's own settings.
import { CommercetoolsConfig } from "@evolve-framework/commercetools";| Variable | Description |
|---|---|
CTP_API_URLrequired | The region's API host, such as https://api.europe-west1.gcp.commercetools.com. |
CTP_AUTH_URLrequired | The region's auth host, such as https://auth.europe-west1.gcp.commercetools.com. |
CTP_CLIENT_IDrequired | The service's own API client, used for system-scoped requests. |
CTP_CLIENT_SECREToptional · secret | That client's secret. Removed from the environment once read. |
CTP_PROJECT_KEYrequired | The commercetools project's key. |
CTP_SCOPESrequired · list, "," | The service client's scopes, comma-separated in the environment. |
CTP_USER_CLIENT_IDoptional | The API client that issues anonymous and customer tokens. |
CTP_USER_CLIENT_SECREToptional · secret | That client's secret. Removed from the environment once read. |
CTP_USER_SCOPESoptional · list, "," | The scopes of anonymous and customer tokens. Defaults to DEFAULT_USER_SCOPES.Default view_published_products,manage_my_shopping_lists,manage_my_profile,manage_my_orders,manage_my_payments,manage_my_business_units,manage_my_quote_requests |
Every service's variables on one page: Configuration.

