Loading src/Makefile.am +3 −2 Original line number Diff line number Diff line Loading @@ -218,6 +218,7 @@ config/defaults.cpp: Makefile echo " const char* progname = \"urd\";"; \ echo " const bool daemonize = true;"; \ echo " const bool use_syslog = false;"; \ echo " const bool use_console = false;"; \ echo " const bfs::path log_file = boost::filesystem::path();"; \ echo " const uint32_t log_file_max_size = static_cast<uint32_t>(16*1024*1024);"; \ echo ""; \ Loading src/config.hpp +1 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ #ifndef __NORNS_CONFIG_HPP__ #define __NORNS_CONFIG_HPP__ #include "config.h" #include "config/defaults.hpp" #include "config/settings.hpp" Loading src/config/defaults.hpp +1 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ namespace defaults { extern const char* progname; extern const bool daemonize; extern const bool use_syslog; extern const bool use_console; extern const bfs::path log_file; extern const uint32_t log_file_max_size; extern const bool dry_run; Loading src/config/settings.cpp +23 −6 Original line number Diff line number Diff line Loading @@ -45,17 +45,27 @@ namespace norns { namespace config { settings::settings() { } settings::settings(const std::string& progname, bool daemonize, bool use_syslog, const bfs::path& log_file, const uint32_t log_file_max_size, bool dry_run, uint32_t dry_run_duration, settings::settings(const std::string& progname, bool daemonize, bool use_syslog, bool use_console, const bfs::path& log_file, const uint32_t log_file_max_size, bool dry_run, uint32_t dry_run_duration, const bfs::path& global_socket, const bfs::path& control_socket, uint32_t remote_port, const bfs::path& pidfile, uint32_t workers, uint32_t backlog_size, const bfs::path& cfgfile, const bfs::path& control_socket, uint32_t remote_port, const bfs::path& pidfile, uint32_t workers, uint32_t backlog_size, const bfs::path& cfgfile, const std::list<namespace_def>& defns) : m_progname(progname), m_daemonize(daemonize), m_use_syslog(use_syslog), m_use_console(use_console), m_log_file(log_file), m_log_file_max_size(log_file_max_size), m_dry_run(dry_run), Loading @@ -73,6 +83,7 @@ void settings::load_defaults() { m_progname = defaults::progname; m_daemonize = defaults::daemonize; m_use_syslog = defaults::use_syslog; m_use_console = defaults::use_console; m_log_file = defaults::log_file; m_log_file_max_size = defaults::log_file_max_size; m_dry_run = defaults::dry_run; Loading @@ -98,6 +109,7 @@ void settings::load_from_file(const bfs::path& filename) { m_progname = defaults::progname; m_use_syslog = gsettings.get_as<bool>(keywords::use_syslog); m_use_console = defaults::use_console; if(gsettings.has(keywords::log_file)) { m_log_file = gsettings.get_as<bfs::path>(keywords::log_file); Loading Loading @@ -137,6 +149,7 @@ std::string settings::to_string() const { " m_progname: " + m_progname + ",\n" + " m_daemonize: " + (m_daemonize ? "true" : "false") + ",\n" + " m_use_syslog: " + (m_use_syslog ? "true" : "false") + ",\n" + " m_use_console: " + (m_use_console ? "true" : "false") + ",\n" + " m_log_file: " + m_log_file.string() + ",\n" + " m_log_file_max_size: " + std::to_string(m_log_file_max_size) + ",\n" + " m_dry_run: " + (m_dry_run ? "true" : "false") + ",\n" + Loading Loading @@ -165,6 +178,10 @@ bool& settings::use_syslog() { return m_use_syslog; } bool& settings::use_console() { return m_use_console; } bfs::path& settings::log_file() { return m_log_file; } Loading src/config/settings.hpp +23 −10 Original line number Diff line number Diff line Loading @@ -39,9 +39,12 @@ namespace config { struct namespace_def { namespace_def(const std::string& nsid, bool track, const bfs::path& mountpoint, const std::string& alias, const uint64_t capacity, const std::string& visibility) : namespace_def(const std::string& nsid, bool track, const bfs::path& mountpoint, const std::string& alias, const uint64_t capacity, const std::string& visibility) : m_nsid(nsid), m_track(track), m_mountpoint(mountpoint), Loading Loading @@ -84,13 +87,21 @@ struct namespace_def { struct settings { settings(); settings(const std::string& progname, bool daemonize, bool use_syslog, const bfs::path& log_file, const uint32_t log_file_max_size, bool dry_run, uint32_t dry_run_duration, settings(const std::string& progname, bool daemonize, bool use_syslog, bool use_console, const bfs::path& log_file, const uint32_t log_file_max_size, bool dry_run, uint32_t dry_run_duration, const bfs::path& global_socket, const bfs::path& control_socket, uint32_t remote_port, const bfs::path& pidfile, uint32_t workers, uint32_t backlog_size, const bfs::path& cfgfile, const bfs::path& control_socket, uint32_t remote_port, const bfs::path& pidfile, uint32_t workers, uint32_t backlog_size, const bfs::path& cfgfile, const std::list<namespace_def>& defns); void load_defaults(); void load_from_file(const bfs::path& filename); Loading @@ -99,6 +110,7 @@ struct settings { std::string& progname(); bool& daemonize(); bool& use_syslog(); bool& use_console(); bfs::path& log_file(); uint32_t& log_file_max_size(); bool& dry_run(); Loading @@ -115,6 +127,7 @@ struct settings { std::string m_progname = defaults::progname; bool m_daemonize = defaults::daemonize; bool m_use_syslog = defaults::use_syslog; bool m_use_console = defaults::use_console; bfs::path m_log_file = defaults::log_file; uint32_t m_log_file_max_size = defaults::log_file_max_size; bool m_dry_run = defaults::dry_run; Loading Loading
src/Makefile.am +3 −2 Original line number Diff line number Diff line Loading @@ -218,6 +218,7 @@ config/defaults.cpp: Makefile echo " const char* progname = \"urd\";"; \ echo " const bool daemonize = true;"; \ echo " const bool use_syslog = false;"; \ echo " const bool use_console = false;"; \ echo " const bfs::path log_file = boost::filesystem::path();"; \ echo " const uint32_t log_file_max_size = static_cast<uint32_t>(16*1024*1024);"; \ echo ""; \ Loading
src/config.hpp +1 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ #ifndef __NORNS_CONFIG_HPP__ #define __NORNS_CONFIG_HPP__ #include "config.h" #include "config/defaults.hpp" #include "config/settings.hpp" Loading
src/config/defaults.hpp +1 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ namespace defaults { extern const char* progname; extern const bool daemonize; extern const bool use_syslog; extern const bool use_console; extern const bfs::path log_file; extern const uint32_t log_file_max_size; extern const bool dry_run; Loading
src/config/settings.cpp +23 −6 Original line number Diff line number Diff line Loading @@ -45,17 +45,27 @@ namespace norns { namespace config { settings::settings() { } settings::settings(const std::string& progname, bool daemonize, bool use_syslog, const bfs::path& log_file, const uint32_t log_file_max_size, bool dry_run, uint32_t dry_run_duration, settings::settings(const std::string& progname, bool daemonize, bool use_syslog, bool use_console, const bfs::path& log_file, const uint32_t log_file_max_size, bool dry_run, uint32_t dry_run_duration, const bfs::path& global_socket, const bfs::path& control_socket, uint32_t remote_port, const bfs::path& pidfile, uint32_t workers, uint32_t backlog_size, const bfs::path& cfgfile, const bfs::path& control_socket, uint32_t remote_port, const bfs::path& pidfile, uint32_t workers, uint32_t backlog_size, const bfs::path& cfgfile, const std::list<namespace_def>& defns) : m_progname(progname), m_daemonize(daemonize), m_use_syslog(use_syslog), m_use_console(use_console), m_log_file(log_file), m_log_file_max_size(log_file_max_size), m_dry_run(dry_run), Loading @@ -73,6 +83,7 @@ void settings::load_defaults() { m_progname = defaults::progname; m_daemonize = defaults::daemonize; m_use_syslog = defaults::use_syslog; m_use_console = defaults::use_console; m_log_file = defaults::log_file; m_log_file_max_size = defaults::log_file_max_size; m_dry_run = defaults::dry_run; Loading @@ -98,6 +109,7 @@ void settings::load_from_file(const bfs::path& filename) { m_progname = defaults::progname; m_use_syslog = gsettings.get_as<bool>(keywords::use_syslog); m_use_console = defaults::use_console; if(gsettings.has(keywords::log_file)) { m_log_file = gsettings.get_as<bfs::path>(keywords::log_file); Loading Loading @@ -137,6 +149,7 @@ std::string settings::to_string() const { " m_progname: " + m_progname + ",\n" + " m_daemonize: " + (m_daemonize ? "true" : "false") + ",\n" + " m_use_syslog: " + (m_use_syslog ? "true" : "false") + ",\n" + " m_use_console: " + (m_use_console ? "true" : "false") + ",\n" + " m_log_file: " + m_log_file.string() + ",\n" + " m_log_file_max_size: " + std::to_string(m_log_file_max_size) + ",\n" + " m_dry_run: " + (m_dry_run ? "true" : "false") + ",\n" + Loading Loading @@ -165,6 +178,10 @@ bool& settings::use_syslog() { return m_use_syslog; } bool& settings::use_console() { return m_use_console; } bfs::path& settings::log_file() { return m_log_file; } Loading
src/config/settings.hpp +23 −10 Original line number Diff line number Diff line Loading @@ -39,9 +39,12 @@ namespace config { struct namespace_def { namespace_def(const std::string& nsid, bool track, const bfs::path& mountpoint, const std::string& alias, const uint64_t capacity, const std::string& visibility) : namespace_def(const std::string& nsid, bool track, const bfs::path& mountpoint, const std::string& alias, const uint64_t capacity, const std::string& visibility) : m_nsid(nsid), m_track(track), m_mountpoint(mountpoint), Loading Loading @@ -84,13 +87,21 @@ struct namespace_def { struct settings { settings(); settings(const std::string& progname, bool daemonize, bool use_syslog, const bfs::path& log_file, const uint32_t log_file_max_size, bool dry_run, uint32_t dry_run_duration, settings(const std::string& progname, bool daemonize, bool use_syslog, bool use_console, const bfs::path& log_file, const uint32_t log_file_max_size, bool dry_run, uint32_t dry_run_duration, const bfs::path& global_socket, const bfs::path& control_socket, uint32_t remote_port, const bfs::path& pidfile, uint32_t workers, uint32_t backlog_size, const bfs::path& cfgfile, const bfs::path& control_socket, uint32_t remote_port, const bfs::path& pidfile, uint32_t workers, uint32_t backlog_size, const bfs::path& cfgfile, const std::list<namespace_def>& defns); void load_defaults(); void load_from_file(const bfs::path& filename); Loading @@ -99,6 +110,7 @@ struct settings { std::string& progname(); bool& daemonize(); bool& use_syslog(); bool& use_console(); bfs::path& log_file(); uint32_t& log_file_max_size(); bool& dry_run(); Loading @@ -115,6 +127,7 @@ struct settings { std::string m_progname = defaults::progname; bool m_daemonize = defaults::daemonize; bool m_use_syslog = defaults::use_syslog; bool m_use_console = defaults::use_console; bfs::path m_log_file = defaults::log_file; uint32_t m_log_file_max_size = defaults::log_file_max_size; bool m_dry_run = defaults::dry_run; Loading