ConfigCat SDK for C++ provides easy integration for your application to ConfigCat.
C++ Standard Minimum Level: C++17
.
ConfigCat is a feature flag and configuration management service that lets you separate releases from deployments. You can turn your features ON/OFF using ConfigCat Dashboard even after they are deployed. ConfigCat lets you target specific groups of users based on region, email or any other custom user attribute.
ConfigCat is a hosted feature flag service. Manage feature toggles across frontend, backend, mobile, desktop apps. Alternative to LaunchDarkly. Management app + feature flag SDKs.
With Vcpkg
-
On Windows:
git clone https://github.com/microsoft/vcpkg .\vcpkg\bootstrap-vcpkg.bat .\vcpkg\vcpkg install configcat
In order to use vcpkg with Visual Studio, run the following command (may require administrator elevation):
.\vcpkg\vcpkg integrate install
After this, you can create a New non-CMake Project (or open an existing one). All installed libraries are immediately ready to be
#include
'd and used in your project without additional configuration. -
On Linux/Mac:
git clone https://github.com/microsoft/vcpkg ./vcpkg/bootstrap-vcpkg.sh ./vcpkg/vcpkg install configcat
In order to use vcpkg with CMake, you can use the toolchain file:
cmake -B [build directory] -S . "-DCMAKE_TOOLCHAIN_FILE=[path to vcpkg]/scripts/buildsystems/vcpkg.cmake"
cmake --build [build directory]
We recommend that you use the vcpkg.json
manifest file to add the dependencies to your project.
You can find an example manifest file here.
2. Go to the ConfigCat Dashboard to get your SDK Key
#include <configcat/configcat.h>
using namespace configcat;
auto client = ConfigCatClient::get("#YOUR-SDK-KEY#");
bool isMyAwesomeFeatureEnabled = client->getValue("isMyAwesomeFeatureEnabled", false);
if (isMyAwesomeFeatureEnabled) {
doTheNewThing();
} else {
doTheOldThing();
}
ConfigCatClient::closeAll();
Using this feature, you will be able to get different setting values for different users in your application by passing a User Object
to the getValue()
function.
Read more about Targeting here.
Percentage and targeted rollouts are calculated by the user object passed to the configuration requests. The user object must be created with a mandatory identifier parameter which uniquely identifies each user:
auto user = ConfigCatUser::create("#USER-IDENTIFIER#");
bool isMyAwesomeFeatureEnabled = client->getValue("isMyAwesomeFeatureEnabled", false, user);
if (isMyAwesomeFeatureEnabled) {
doTheNewThing();
} else {
doTheOldThing();
}
The ConfigCat SDK supports three different polling mechanisms to acquire the setting values from ConfigCat. After the latest setting values are downloaded, they are stored in an internal cache . After that, all requests are served from the cache. Read more about Polling Modes and how to use them at ConfigCat C++ Docs.
If you need help using this SDK, feel free to contact the ConfigCat Staff at https://configcat.com. We're happy to help.
Contributions are welcome. For more info please read the Contribution Guideline.
ConfigCat C++ SDK uses these wonderful libraries: hash-library, libcurl, nlohmann-json, z4kn4fein-semver.