bool PlainConfig::Validate()

in source/config/Config.cpp [243:326]


bool PlainConfig::Validate() const
{
#if !defined(DISABLE_MQTT)
    if (!endpoint.has_value() || endpoint->empty())
    {
        LOGM_ERROR(Config::TAG, "*** %s: Endpoint is missing ***", DeviceClient::DC_FATAL_ERROR);
        return false;
    }
    if (!cert.has_value() || cert->empty())
    {
        LOGM_ERROR(Config::TAG, "*** %s: Certificate is missing ***", DeviceClient::DC_FATAL_ERROR);
        return false;
    }
    else if (!FileUtils::IsValidFilePath(cert->c_str()))
    {
        return false;
    }
    if (!key.has_value() || key->empty())
    {
        LOGM_ERROR(Config::TAG, "*** %s: Private Key is missing ***", DeviceClient::DC_FATAL_ERROR);
        return false;
    }
    else if (!FileUtils::IsValidFilePath(key->c_str()))
    {
        return false;
    }
    if (!rootCa.has_value() || rootCa->empty())
    {
        LOGM_ERROR(Config::TAG, "*** %s: Root CA is missing ***", DeviceClient::DC_FATAL_ERROR);
        return false;
    }
    else if (!FileUtils::IsValidFilePath(rootCa->c_str()))
    {
        return false;
    }
    if (!thingName.has_value() || thingName->empty())
    {
        LOGM_ERROR(Config::TAG, "*** %s: Thing name is missing ***", DeviceClient::DC_FATAL_ERROR);
        return false;
    }
#endif
    if (!logConfig.Validate())
    {
        return false;
    }
#if !defined(EXCLUDE_JOBS)
    if (!jobs.Validate())
    {
        return false;
    }
#endif
#if !defined(EXCLUDE_DD)
    if (!deviceDefender.Validate())
    {
        return false;
    }
#endif
#if !defined(EXCLUDE_ST)
    if (!tunneling.Validate())
    {
        return false;
    }
#endif
#if !defined(EXCLUDE_FP)
    if (!fleetProvisioning.Validate())
    {
        return false;
    }
#endif
#if !defined(EXCLUDE_PUBSUB)
    if (!pubSub.Validate())
    {
        return false;
    }
#endif
#if !defined(EXCLUDE_SHADOW)
    if (!sampleShadow.Validate() || !configShadow.Validate())
    {
        return false;
    }
#endif

    return true;
}