-
Notifications
You must be signed in to change notification settings - Fork 17
configuration lib
Marten Rebane edited this page Jan 21, 2020
·
1 revision
Central configuration for RIA DigiDoc
To fetch and package default configuration, run command:
gradle clean fetchAndPackageDefaultConfiguration app:assemble
The default configuration setup is:
Configuration downloaded from: https://id.eesti.ee/
Configuration update interval: 7
(days)
The central configuration options can be overridden with command (replace --args
with custom values):
gradle clean fetchAndPackageDefaultConfiguration --args='https://example.com 5' app:assemble
The first argument (URL) is where the configuration is downloaded from. The second argument is interval, where every given number of days, the configuration is updated.
- The URL argument must contain only the base URL. For example if the specified URL is
https://id.eesti.ee/
, then the configuration will be downloaded fromhttps://id.eesti.ee/config.json
(public key from/config.pub
and signature from/config.rsa
)
The build will be stopped if configuration validation fails.
CachedConfigurationHandler cachedConfHandler = new CachedConfigurationHandler(getCacheDir());
ConfigurationProperties confProperties = new ConfigurationProperties(getAssets());
ConfigurationManager confManager = new ConfigurationManager(this, confProperties, cachedConfHandler, UserAgentUtil.getUserAgent(getApplicationContext()));
confManager.getConfiguration();
CachedConfigurationHandler cachedConfHandler = new CachedConfigurationHandler(getCacheDir());
ConfigurationProperties confProperties = new ConfigurationProperties(getAssets());
ConfigurationManager confManager = new ConfigurationManager(this, confProperties, cachedConfHandler, UserAgentUtil.getUserAgent(getApplicationContext()));
confManager.forceLoadDefaultConfiguration();
CachedConfigurationHandler cachedConfHandler = new CachedConfigurationHandler(getCacheDir());
ConfigurationProperties confProperties = new ConfigurationProperties(getAssets());
ConfigurationManager confManager = new ConfigurationManager(this, confProperties, cachedConfHandler, UserAgentUtil.getUserAgent(getApplicationContext()));
confManager.forceLoadDefaultConfiguration();
File: configuration.properties
ConfigurationProperties confProperties = new ConfigurationProperties(getAssets());
confProperties.getConfigurationVersionSerial();
Used to cache and get configuration data
CachedConfigurationHandler cachedConfigurationHandler = new CachedConfigurationHandler(getCacheDir());
cachedConfHandler.doesCachedConfigurationExist(); // true or false
CachedConfigurationHandler cachedConfigurationHandler = new CachedConfigurationHandler(getCacheDir());
cachedConfHandler.getConfigurationVersionSerial();
CachedConfigurationHandler cachedConfigurationHandler = new CachedConfigurationHandler(getCacheDir());
cachedConfHandler.getConfLastUpdateCheckDate();
CachedConfigurationHandler cachedConfigurationHandler = new CachedConfigurationHandler(getCacheDir());
cachedConfHandler.getConfUpdateDate();