{"id":15486162,"url":"https://github.com/cieslarmichal/config-cxx","last_synced_at":"2025-10-03T22:50:42.217Z","repository":{"id":212969362,"uuid":"730881754","full_name":"cieslarmichal/config-cxx","owner":"cieslarmichal","description":"C++ Config library for managing application configuration.","archived":false,"fork":false,"pushed_at":"2024-07-27T19:15:24.000Z","size":503,"stargazers_count":21,"open_issues_count":3,"forks_count":7,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-23T08:17:30.261Z","etag":null,"topics":["config","config-management","cpp","cpp20","json"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cieslarmichal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["cieslarmichal"]}},"created_at":"2023-12-12T22:05:13.000Z","updated_at":"2024-10-12T14:18:07.000Z","dependencies_parsed_at":"2024-07-27T06:34:01.819Z","dependency_job_id":"cdba62b5-e8e1-4ebe-8007-0f8f1b9c3563","html_url":"https://github.com/cieslarmichal/config-cxx","commit_stats":{"total_commits":108,"total_committers":6,"mean_commits":18.0,"dds":"0.12962962962962965","last_synced_commit":"80d25793c278b90719a13cd9cc6c28a5e0202d77"},"previous_names":["cieslarmichal/config-cxx"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cieslarmichal%2Fconfig-cxx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cieslarmichal%2Fconfig-cxx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cieslarmichal%2Fconfig-cxx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cieslarmichal%2Fconfig-cxx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cieslarmichal","download_url":"https://codeload.github.com/cieslarmichal/config-cxx/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246126662,"owners_count":20727594,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["config","config-management","cpp","cpp20","json"],"created_at":"2024-10-02T06:06:50.347Z","updated_at":"2025-10-03T22:50:37.182Z","avatar_url":"https://github.com/cieslarmichal.png","language":"C++","funding_links":["https://github.com/sponsors/cieslarmichal"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003eConfig C++\u003c/h1\u003e\n  \u003cp\u003eManage your C++ application config.\u003c/p\u003e\n\n[![clang++](https://github.com/cieslarmichal/config-cxx/actions/workflows/linux-clang-build.yml/badge.svg?branch=main)](https://github.com/cieslarmichal/config-cxx/actions/workflows/linux-clang-build.yml?query=branch%3Amain)\n[![apple clang++](https://github.com/cieslarmichal/config-cxx/actions/workflows/macos-clang-build.yml/badge.svg?branch=main)](https://github.com/cieslarmichal/config-cxx/actions/workflows/macos-clang-build.yml?query=branch%3Amain)\n[![g++](https://github.com/cieslarmichal/config-cxx/actions/workflows/linux-gxx-build.yml/badge.svg?branch=main)](https://github.com/cieslarmichal/config-cxx/actions/workflows/linux-gxx-build.yml?query=branch%3Amain)\n[![msvc](https://github.com/cieslarmichal/config-cxx/actions/workflows/windows-msvc-build.yml/badge.svg?branch=main)](https://github.com/cieslarmichal/config-cxx/actions/workflows/windows-msvc-build.yml?query=branch%3Amain)\n[![codecov](https://codecov.io/github/cieslarmichal/config-cxx/branch/main/graph/badge.svg?token=0RTV4JFH2U)](https://codecov.io/github/cieslarmichal/config-cxx)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)\n[![Chat on Discord](https://img.shields.io/badge/chat-discord-blue?style=flat\u0026logo=discord)](https://discord.gg/h2ur8H6mK6)\n\u003c/div\u003e\n\n## Table of contents\n\n- [Goal](#goal)\n- [Introduction](#introduction)\n- [Quick start](#quick-start)\n    - [Installing config-cxx](#install-in-your-app-directory-and-edit-the-default-config-file)\n    - [Editing config overrides](#edit-config-overrides-for-production-deployment)\n    - [Usage](#use-configs-in-your-code)\n- [Articles](#-articles)\n  - [Configuration Files](./docs/wiki/configuration-files.md)\n  - [Environment Variables](./docs/wiki/environment-variables.md)\n- [Examples](#examples)\n- [Compiler support](#compiler-support)\n\n\n## 🎯 Goal\n\nGoal of the Config C++ is to provide a library like [node-config](https://github.com/node-config/node-config) to the C++\ncommunity.\n\n## Introduction\n\nConfig C++ organizes hierarchical configurations for your app deployments.\n\nIt lets you define a set of default parameters,\nand extend them for different deployment environments (development, testing,\nstaging, production, etc.).\n\nConfigurations are stored in [configuration files](./docs/wiki/configuration-files.md) within your application, and can be overridden and extended by [environment variables](./docs/wiki/environment-variables.md).\n\n## Quick Start\n\nThe following examples are in JSON format (YAML and XML are also supported).\n\n### Install in your app directory, and edit the default config file:\n\n1. Add config to git submodules (execute in project root):\n\n```shell\n$ mkdir externals \u0026\u0026 cd externals\n$ git submodule add https://github.com/cieslarmichal/config-cxx.git\n$ git submodule update --init --recursive\n```\n\n2. Link with library:\n\n```cmake\nset(BUILD_CONFIG_CXX_TESTS OFF)\n\nadd_subdirectory(externals/config-cxx)\n\nadd_executable(main Main.cpp)\n\ntarget_link_libraries(main config-cxx)\n```\n\n```\n$ mkdir config\n$ vi config/default.json\n```\n\n```js\n{\n  \"db\": {\n    \"name\": \"users\",\n    \"host\": \"localhost\",\n    \"port\": 3306,\n    \"user\": \"default\",\n    \"password\": \"default\"\n  }\n}\n```\n\n### Edit config overrides for production deployment:\n\n```shell\n $ vi config/production.json\n```\n\n```json\n{\n  \"db\": {\n    \"host\": \"postgres\",\n    \"user\": \"admin\",\n    \"password\": \"secretpassword\"\n  }\n}\n```\n\n### Use configs in your code:\n\n```cpp\n#include \u003ciostream\u003e\n#include \"config-cxx/Config.h\"\n\nconfig::Config config;\n\nauto dbName = config.get\u003cstd::string\u003e(\"db.name\"); // \"users\"\nauto dbHost = config.get\u003cstd::string\u003e(\"db.host\"); // \"postgres\"\nauto dbPort = config.get\u003cint\u003e(\"db.port\"); // 3306\nauto dbUser = config.get\u003cint\u003e(\"db.user\"); // \"admin\"\nauto dbPassword = config.get\u003cint\u003e(\"db.password\"); // \"secretpassword\"\nauto authEnabled = config.get\u003cbool\u003e(\"auth.enabled\"); // true\n```\n\n\n`config.get()` will throw an exception for undefined keys to help catch typos and missing values.\nUse `config.has()` to test if a configuration value is defined.\n\n### Before starting your app specify target CXX environment:\n\n```shell\n$ export CXX_ENV=production\n```\n\nRunning in this configuration, the `port` and `name` elements of `db`\nwill come from the `default.json` file, and the `host`, `user` and `password` elements will\ncome from the `production.json` override file.\n\n## 📖 Articles\n\n* [Configuration Files](./docs/wiki/configuration-files.md)\n* [Environment Variables](./docs/wiki/environment-variables.md)\n\n## Examples\n\nCheck out the example project in [examples directory](https://github.com/cieslarmichal/config-cxx/tree/main/examples/project).\n\n## Compiler support\n\n- [MSVC➚](https://en.wikipedia.org/wiki/Microsoft_Visual_Studio) version 143 or newer.\n- [GCC➚](https://gcc.gnu.org/) version 13 or newer.\n- [Clang➚](https://clang.llvm.org/) version 16 or newer.\n- [Apple Clang➚](https://clang.llvm.org/) version 16 or newer.\n\n## Dependencies\n\n- GTest (set ```BUILD_CONFIG_CXX_TESTS=OFF``` CMake flag to disable this dependency)\n- nlohmann/json\n\n## Contributing\n\nFeel free to join Config C++ development! 🚀\n\nPlease check [CONTRIBUTING](https://github.com/cieslarmichal/config-cxx/blob/main/CONTRIBUTING.md) guide.\n\nVisit us on [discord](https://discord.gg/h2ur8H6mK6) if you want to know more about contributing.\n\n## 📝 Compilation guides\n\n- [Clang++](./docs/guides/clang-compilation-guide.md)\n- [Apple Clang++](./docs/guides/apple-clang-compilation-guide.md)\n- [G++](./docs/guides/gcc-compilation-guide.md)\n- [MSVC](./docs/guides/msvc-compilation-guide.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcieslarmichal%2Fconfig-cxx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcieslarmichal%2Fconfig-cxx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcieslarmichal%2Fconfig-cxx/lists"}