Skip to main content

Project configuration

The environment folder contains configuration for each environment in your Archibald project. This folder should be in the root of your Archibald project.

If you created an Archibald project with the npm init @archibald package, there should already be a sample configuration in your project’s directory. By default, the environment folder contains a common.ts file with common configuration that applies to all environments. Additionally, there is a configuration file per environment. E.g., environment folder that is added when using @archibald/bootstrap package to generate a new project.

/
|-- /environment
|-- common.ts
|-- local.ts

Configuration options

DefaultAppConfig

Configuration includes five main parts:

PropertyTypeDescription
generalDefaultGeneralConfigDefines general purpose configuration.
hybrisDefaultHybrisConfigDefines configuration needed for the communication with SAP commerce.
appDefaultAppConfigDefines client configuration.
serverDefaultServerConfigDefines server configuration.
tenantsDefaultTenantsConfigDefines platform/tenant configuration. This configuration can be used to override the configuration defined in the app property.

general

DefaultGeneralConfig

Representation of general purpose configuration.

PropertyTypeDescription
useSecureCookiesbooleanDefines if server side cookies should be secure or not. **
memwatchDefaultMemWatchConfigDefines configuration that is used to detect and find memory leaks in Node.JS code.
memwatch

DefaultMemWatchConfig

Representation of configuration that is used to detect and find memory leaks in Node.JS code.

PropertyTypeDescription
activeDefaultMemWatchActivationDefines status of memwatch instance. DefaultMemWatchActivation enum is used with following values:
  • 0 (UNINITIALIZED)
  • 1 (ACTIVE)
  • 2 (FAILED)
printbooleanDefines whether memwatch info should be printed or not.

hybris

DefaultHybrisConfig

Representation of configuration needed for the communication with SAP commerce.

PropertyTypeDescription
apiDefaultApiConfigDefines SAP commerce api configuration.
oauthDefaultOAuthCredentialsOAuth client used by the commerce auth providers: client_id, client_secret, plus optional keys such as scope and redirect_uri for the OIDC login flow.

app

DefaultAppConfig

Representation of client configuration.

PropertyTypeDescription
logLevelLogLevelDefines log level that should be used for logging. LogLevel enum is used with following values:
  • error
  • warn
  • info
  • debug
  • trace
supportedLanguagesunknown[]Defines a list of supported languages. Typing of this property is overridden in a project.
defaultLanguageunknownDefines the default language. Typing of this property is overridden in a project. Usually the Language enum is used for typing.
baseSitestringDefines base site needed to connect to SAP commerce.
canonicalBaseUrlstringThe public base URL of the application. Also used as the JWE token iss claim and as the base for the OIDC redirect_uri.
apiDefaultApiConfigDefines client api configuration.
routeobjectDefines route configuration.
authenticationAuthConfigDefines authentication configuration.

authentication

AuthConfig

Controls which login protocols the auth endpoints are registered for (server-side) and accepted from (client-side). See the OIDC Login Flow guide.

PropertyTypeDescription
whitelistedProtocolsAuthProtocol[] ('password' | 'oidc')Whitelisted authentication protocols. 'password' registers POST auth/login; 'oidc' registers GET auth/login, POST auth/token, and GET auth/callback.

route

Representation of route configuration.

PropertyTypeDescription
prefixstringDefines a prefix that will be prepended to every client route.

server

DefaultServerConfig

Representation of server configuration.

PropertyTypeDescription
cookiesobjectDefines how cookies are handled on the server. 
credentialsobjectDefines credentials needed for the authentication with 3rd party systems.
gitobjectDefines branch/tag and commit hash currently deployed to a system.

cookies

Representation of configuration towards cookie handling. Mainly used by the CookieDecorator.

PropertyTypeDescription
whitelistboolean | string[]true means the CookieDecorator will use the registered cookies from HapiJS, otherwise a list of whitlisted cookies can be provided here directly.

credentials

Representation of credentials needed for the authentication with 3rd party systems.

PropertyTypeDescription
oauthobjectDefines credentials needed for the OAuth authentication with SAP commerce.
tokenobjectDefines the secrets used to encrypt the JWE session tokens issued by the AuthModule.

token

Secrets for the encrypted session tokens. Referenced from the AuthModule registration as server.credentials.token.secret.

PropertyTypeDescription
secretstringPrimary JWE encryption secret. Must be exactly 32 characters.
secret_rotationstringOptional secondary secret tried on decryption failure, enabling zero-downtime secret rotation.

git

Representation of an object that contains branch/tag and commit hash currently deployed to a system.

PropertyTypeDescription
versionstringDefines name of branch/tag.
hashstringDefines commit hash.

tenants

DefaultTenantsConfig

Representation of platform/tenant configuration. This configuration can be used to override the configuration defined in the app property. E.g. newly created project has the following tenants config:

tenants: {
[Platform.SHOP]: {
[Tenant.NETCONOMY_B2C]: {
app: {}
},
},
}

api

DefaultAppApiConfig

Representation of api configuration for app.

PropertyTypeDescription
protocolstringDefines protocol used in the request URL. E.g. <protocol>://localhost:3100/jsapi/v2/path
hoststringDefines host used in the request URL. E.g. https://<host>:3100/jsapi/v2/path
portstringDefines port used in the request URL. E.g. https://localhost:<port>/jsapi/v2/path
basestringDefines base for request to the server. E.g. https://localhost:3100/<base>/v2/path
baseSitestringDefines base site needed to connect to SAP commerce.
useMiddlewarebooleanDefines whether the requests should go against the server or the configured host directly.
mockedbooleanDefines whether the requests are mocked or not.
retryRetryOptionsDefines how many times a request should be resent if it fails and after what time.

DefaultApiConfig

Representation of an ordinary api configuration without the specifics of the app api config.

PropertyTypeDescription
protocolstringDefines protocol used in the request URL. E.g. <protocol>://localhost:3100/jsapi/v2/path
hoststringDefines host used in the request URL. E.g. https://<host>:3100/jsapi/v2/path
portstringDefines port used in the request URL. E.g. https://localhost:<port>/jsapi/v2/path
basestringDefines base for request to the server. E.g. https://localhost:3100/<base>/v2/path
baseSitestringDefines base site needed to connect to SAP commerce.
mockedbooleanDefines whether the requests are mocked or not.
retryRetryOptionsDefines how many times a request should be resent if it fails and after what time.
rejectUnauthorizedbooleanWARNING: This property MUST NOT be set to false for production environments. Defines if a self-signed SSL certificates should be used for the connection to SAP commerce. When set to false the "process.env.NODE_TLS_REJECT_UNAUTHORIZED" property will be set to "0". This will disable certificate checks for all https client calls and hence is not secured.

retry

Defines how many times a request should be resent if it fails. It also defines initial delay time.

PropertyTypeDescription
timesnumberDefines how many times a request should be resent if it fails
delaynumberDefines the first wait time to delay. Each retry doubles the current delay.