https://github.com/ttldtor/config
Library for configuring applications.
https://github.com/ttldtor/config
Last synced: 6 months ago
JSON representation
Library for configuring applications.
- Host: GitHub
- URL: https://github.com/ttldtor/config
- Owner: ttldtor
- License: bsl-1.0
- Created: 2025-10-04T19:16:26.000Z (9 months ago)
- Default Branch: default
- Last Pushed: 2025-10-04T22:27:53.000Z (9 months ago)
- Last Synced: 2025-10-05T00:19:57.296Z (9 months ago)
- Language: C++
- Size: 9.77 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# config
Library for configuring applications.

[](https://github.com/ttldtor/config/releases/latest)
[](https://github.com/ttldtor/config/blob/default/LICENSE.txt)
## Examples of usage
### CMake
```cmake
cmake_minimum_required(VERSION 3.16)
project(test_config LANGUAGES CXX)
include(FetchContent)
FetchContent_Declare(
config
GIT_REPOSITORY https://github.com/ttldtor/config.git
GIT_TAG v1.0.3
)
FetchContent_MakeAvailable(config)
add_executable(${PROJECT_NAME} src/main.cpp)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20)
target_link_libraries(${PROJECT_NAME} PRIVATE config)
```
### Code
```c++
#include
#include
using namespace org::ttldtor::config;
// set MY_PREFIX_user=test
int main() {
Config config{};
config.addSource(IniSource::fromString(R"("
user=demo
password=demo
")"));
for (const auto& [key, value] : config) {
std::cout << key << " = " << value << '\n';
}
// user = demo
// password = demo
config.addSource(EnvSource("MY_PREFIX_"));
for (const auto& [key, value] : config) {
std::cout << key << " = " << value << '\n';
}
// user = test
// password = demo
return 0;
}
```