#include "config.h" #include #include #include po::variables_map config::vm; void config::init() { po::options_description desc("foo"); desc.add_options() ("audist.music_root", po::value(), "music root") ("audist.httpd_port", po::value()->default_value(8000), "httpd port") ("audist.threads", po::value()->default_value(10), "threads") ("audist.database", po::value(), "database string") ; std::ifstream is("audist.conf", std::ios::in); po::store(po::parse_config_file(is, desc, true), vm); po::notify(vm); if(!vm.count("audist.music_root")) { throw std::runtime_error("audist.music_root must be specified in audist.conf"); } if(!vm.count("audist.database")) { throw std::runtime_error("audist.database must be specified in audist.conf"); } }