1. Overview
Configuration parser and serializer. Expands paths, applies defaults, maps JSON values into typed structures and serializes the effective configuration back to disk.
The original source path is:
src/config/Config.cpp
2. Role in the Daemon
This file participates in the privileged BastionGuard Secure Connection daemon. It uses the shared bsc models and follows the daemon-wide fallback strategy: optional high-fidelity backends are used when available, while portable polling or stub behavior preserves service startup.
3. Namespaces
bsc::config
4. Dependencies and Included Interfaces
bsc/config/Config.hppfilesystemfstreamiomanipnlohmann/json.hppsstreamcstdlibstdexcept
5. API and Functions
The file declares or implements the following callable entry points:
expand_path(std::string path)to_json(const Config& cfg)read_file(const std::string& path)load_file(const std::string& path)save_file(const Config& cfg, const std::string& path)
6. Constants and Compile-Time Controls
auto& s = j["Server"]auto& a = s["Authentication"]auto& r = j["Rules"]auto& f = j["FwOptions"]auto& s = j["Stats"]auto& i = j["Internal"]auto& t = j["Tasks"]auto out_path = expand_path(path)
7. External Resources and Protocol Values
Relevant paths, endpoints, command names or policy values referenced by this file include:
bsc/config/Config.hpp
8. Security Considerations
- The component processes privileged operating-system or network data and should run with only the capabilities required by its backend.
- Configuration and protocol JSON must be considered untrusted until successfully parsed and type-checked.
9. Implementation Considerations
- Missing members retain defaults declared by Config.hpp.
- Path expansion supports environment/home-style values before use.
- Configuration serialization preserves the daemon-specific key naming used by the shipped JSON.
- JSON input is an administrative trust boundary; type errors and malformed documents must remain contained.
10. Source Metrics
| Metric | Value |
|---|---|
| File size | 4935 bytes |
| Lines | 113 |
| Detected API entries | 5 |
| Detected types | 0 |
