Exemplo n.º 1
0
void KaaClient::setDefaultConfiguration()
{
#ifdef KAA_USE_CONFIGURATION
    const Botan::SecureVector<std::uint8_t>& config = getDefaultConfigData();
    if (!config.empty()) {
        configurationProcessor_->processConfigurationData(config.begin(), config.size(), true);
    }
#endif
}
Exemplo n.º 2
0
HashDigest getPropertiesHash()
{
    std::ostringstream ss;

    ss << SDK_TOKEN;
    ss << POLLING_PERIOD_SECONDS;
    ss << CLIENT_PUB_KEY_LOCATION;
    ss << CLIENT_PRIV_KEY_LOCATION;
    ss << CLIENT_STATUS_FILE_LOCATION;

    for (const auto& server : getBootstrapServers()) {
        const auto& connectionInfo = server->getConnectionInfo();
        ss.write(reinterpret_cast<const char*>(connectionInfo.data()), connectionInfo.size());
    }

    ss.write(reinterpret_cast<const char*>(
            getDefaultConfigData().data()), getDefaultConfigData().size());

    return EndpointObjectHash(ss.str()).getHashDigest();
}
Exemplo n.º 3
0
void ConfigurationManager::loadConfiguration()
{
    if (storage_) {
        if (state_->isSDKPropertiesUpdated()) {
            KAA_LOG_INFO("Ignore loading configuration from storage: configuration version updated");
            storage_->clearConfiguration();
        } else {
            auto data = storage_->loadConfiguration();
            if (!data.empty()) {
                updateConfiguration(data.data(), data.size());
                isConfigurationLoaded_ = true;
                KAA_LOG_INFO("Loaded configuration from storage");
            }
        }
    }

    if (!isConfigurationLoaded_) {
        const Botan::SecureVector<std::uint8_t>& config = getDefaultConfigData();
        updateConfiguration(config.begin(), config.size());
        isConfigurationLoaded_ = true;
        KAA_LOG_INFO("Loaded default configuration");
    }
}