19 lines
include/config_parser.h
Declares Config struct and parseConfig entry point.
// Config parser interface for the database connection settings loader.
#pragma once
#include <optional>
#include <string>
#include <string_view>
 
// Parsed connection settings for the database service.
struct Config {
  std::string_view host; // connection hostname used for outbound connections
  int              port; // TCP port number
  int              workerThreads; // number of connection pool worker threads
};
 
// Parses a newline-delimited "key=value" config string.
// Required keys: host, port, worker_threads.
// Parameters:
//   input - raw config string fetched from KV and parsed immediately at startup
// Returns: populated Config, or nullopt if any required key is missing or invalid
std::optional<Config> parseConfig(std::string_view input);