App configuration
Configure the Configured Commerce Mobile SDK.
The Optimizely Configured Commerce Mobile SDK has the following files for configuration:
assets/config/base_config.json
– Contains all generic values for the app to function properly.assets/config/custom_config.json
– Lets you or your partner add any customizations.
lib/features/domain/service/interfaces/app_configuration_service_interface.dart
has a member definition for each configuration.
BaseConfiguration? get baseConfig;
is forbase_config.json
.CustomConfiguration? get customConfig;
is forcustom_config.json
.
Add values
If you update any values in base_config.json
, you can easily access those values at runtime by using IAppConfigurationService
.
To incorporate custom logic based on any key included in custom_config.json
, regenerate the lib/core/config/custom_configuration.dart
file to reflect those new keys. Optimizely recommends using Mason (a code generator CLI tool).
The scripts folder contains some helper scripts. From the root of your project, run sh scripts/mason_installer.sh
to install mason. If you have already installed mason, running sh scripts/config_updater.sh
when you add a new key should be sufficient. Afterward, you can access those new key and value from anywhere using IAppConfigurationService
's customConfig
property.
Updated 3 months ago