Configure brX GraphQL Service - Bloomreach Experience - The Headless Digital Experience Platform Built for Commerce

Configure brX GraphQL Service

Introduction

The brX GraphQL Service reads the environment configuration from .env file to integrate with the Commerce Backend Platform. The .env file contains the connection information to the Commerce Backend Platform and other configuration options.

Environment Configuration File

The brX GraphQL Service requires the environment configuration file named .env in the project root folder. An example file is provided as .env.dist in the project root folder, so you can copy the file to .env first and edit the content with correct information.

The .env file consists of the three groups of configuration options:

  1. General Options: the options which are generally applied to the brX GraphQL Service, regardless of the specific Commerce Backend Platform.
  2. Bloomreach Search & Merchandising Connection Settings: the connection settings to integrate with Bloomreach Search & Merchandising.
  3. Commerce Backend Platform Connection Settings: the connection settings to integrate with the specific Commerce Backend Platform(s).

An example .env file looks like the following (lines starting with '#' are comments):

# 1. General Options

NODE_ENV=production
LOG_LEVEL=info 
DEBUG_TRACE_PAYLOAD=false
APOLLO_INTROSPECTION=true
APOLLO_PLAYGROUND=true
JWK_KEYSTORE={ ...SNIP... }
DEFAULT_CONNECTOR_ID=...SNIP...

# 2. brSM Connection Settings

BRSM_API=...SNIP...
BRSM_SUGGEST_API=...SNIP...
BRSM_ACCOUNT_ID=...SNIP...
BRSM_DOMAIN_KEY=...SNIP...

# 3. Commerce Backend Platform Connection Settings (commercetools in this example)

COMMERCETOOLS_API_BASE_URL=...SNIP...
COMMERCETOOLS_AUTH_BASE_URL=...SNIP...
COMMERCETOOLS_PROJECT_KEY=...SNIP...
COMMERCETOOLS_CLIENT_ID=...SNIP...
COMMERCETOOLS_CLIENT_SECRET=...SNIP...
COMMERCETOOLS_SCOPE=...SNIP...

# ... More Commerce Backend Platform Connection Options may follow ...
#

General Options

The following options are supported:

Property Name (* required field) Description Default Value
APOLLO_INTROSPECTION If set to 'true', the Apollo Server Introspection technique is enabled to provide detailed information about a GraphQL API's schema. 'false'
APOLLO_PLAYGROUND If set to 'true', the Apollo Server GraphQL Playground, the in-browser IDE for GraphQL development and workflow, is enabled to provide developers with features such as theme change, automatic schema reloading, HTTP headers configuration, query history and GraphQL subscription support. 'false'
CORS_ORIGIN

The allowed origin which wants to access the brX GraphQL Service as a Cross-Origin Resource Sharing target.
If this is not set or set to an empty string, then the brX GraphQL Service allows access to the clients sending a valid 'Origin' request header.
If set to '*', then the brX GraphQL Service allows access to any clients.
If set to a specific URL (e.g, https://www.example.com), then the brX GraphQL Service allows access only to the clients which are originated from the URL.

 
TOKEN_REFRESH_ENABLED

If set to 'true', the Refreshing Access Token request against Access Management is enabled on the brX GraphQL Service. This option has been disabled by default since v14.3.0.

 
DEFAULT_CONNECTOR_ID brX GraphQL Services reads the Commerce Connector ID from the HTTP request header named 'connector'. If the GraphQL client does not provide a valid Commerce Connector ID value, then this variable is used instead. 'brsm'

DEFAULT_LANGUAGE

The default language code for the client. 'en'
DEFAULT_COUNTRY The default country code for the client. 'US'
DEFAULT_CURRENCY The default currency code for the client. 'USD'
RESPONSE_TIME_HEADER_ENABLED If set to 'true', the internal response time in milliseconds measured in the brX GraphQL Service is passed in the X-Response-Time response header.  

brX Discovery and Commerce Backend Platform Connection Settings and Connector IDs

BrX Discovery and the following Commerce Backend Platforms are supported (differentiated by each unique 'connector' identifier in request header):

How to request configuration changes ?

Please use our support channel to request configuration changes, including properties name and value(s). 

Did you find this page helpful?
How could this documentation serve you better?
On this page
    Did you find this page helpful?
    How could this documentation serve you better?