1 min read

Config File

Last Updated - Platform 23.0 - SDK 18.0

Every app requires an AppConfig.json to configure the backend environment to connect to.

The AppConfig can contain one or more configs for the app to switch between. The app will fatally error on launch if there is a problem with the config specifying exactly what the issue is in the console.

Format

{
"id": "production-gb",
"title": "Production",
"subtitle": null,
"appId": "8e93fddb-7d44-4e13-9cb4-e73172542872",
"appIdInt": "123",
"apiHost": "https://mock.host.com/clients/mock",
"apiVersion": "1.0",
"currencyCode": "GBP",
"countryCode": "GB",
"locale": "en_GB",
"production": true,
"configs": []
}
idRequiredA unique identifier for the config that is stored in the app and used to tag audiences.
titleRequiredA localizable string to describe the environment to the user.
subtitleAn optional substring to explain the environment to the user.
appIdRequiredThe poq backend app identifier string.
appIdIntRequiredThe legacy poq backend app identifier integer.
apiHostRequiredThe API URL prefix / host to proceed all network service paths.
apiVersionRecommendedThe API version used to fetch the correct remote settings for the app.
currencyCodeRequiredThe backend catalogue currency code.
countryCodeRecommendedThe backend catalogue country code and used to tag audiences.
localeSome backend catalogues may require this; this is not the device locale.
productionImportantThis flag is required and must be set to true for production environments that should show to AppStore users. This is optional and should be omitted or false for all other environments.
configsThis is an incredibly powerful property for nesting configs.

Nesting Configs

Configs / environments can be nested where keys are merged down into the lowest level unique configs. This has the following rules and notes:

  • Keys that are required must be present at the lowest level but are optional at higher levels.
  • Keys at lower levels override higher levels.
  • Configs can be deeply nested; there's no limit to configs inside configs.
{
"apiVersion": "1.0",
"currencyCode": "GBP",
"countryCode": "GB",
"locale": "en_GB",
"configs": [
{
"appId": "d9b2c9f3-0d01-4770-9e3b-5a2ca252db06",
"appIdInt": "125",
"apiHost": "https://dev.host.com/clients/mock",
"configs": [
{
"id": "development-gb",
"title": "Development (UK)",
},
{
"id": "development-us",
"title": "Development (US)",
"currencyCode": "USD",
"countryCode": "US",
"locale": "en_US",
}
]
},
{
"id": "staging-gb",
"title": "Staging",
"appId": "f882a70a-a1af-4ce1-ba09-07fca274f0a7",
"appIdInt": "124",
"apiHost": "https://staging.host.com/clients/mock",
},
{
"id": "production-gb",
"title": "Production",
"appId": "8e93fddb-7d44-4e13-9cb4-e73172542872",
"appIdInt": "123",
"apiHost": "https://mock.host.com/clients/mock",
"production": true,
}
]
}

The above example json creates the following environments where the 'Production' environment is the only environment visible to AppStore users. All other environments require developer mode to be enabled.

  • Development (UK)
  • Development (US)
  • Staging
  • Production

Custom Keys

You can add any keys you like to your environment as long as they do not conflict with existing keys (some integrations have their own custom keys to look out for).

Your keys can be used via the current config or more easily via subconfigs.