aboutsummaryrefslogtreecommitdiff
path: root/src/daemon
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon')
-rw-r--r--src/daemon/command_parser_executor.cpp7
-rw-r--r--src/daemon/command_parser_executor.h2
-rw-r--r--src/daemon/command_server.cpp5
-rw-r--r--src/daemon/main.cpp45
4 files changed, 36 insertions, 23 deletions
diff --git a/src/daemon/command_parser_executor.cpp b/src/daemon/command_parser_executor.cpp
index 7a89ebc0c..28a7f1366 100644
--- a/src/daemon/command_parser_executor.cpp
+++ b/src/daemon/command_parser_executor.cpp
@@ -27,6 +27,7 @@
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "common/dns_utils.h"
+#include "version.h"
#include "daemon/command_parser_executor.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
@@ -664,4 +665,10 @@ bool t_command_parser_executor::sync_info(const std::vector<std::string>& args)
return m_executor.sync_info();
}
+bool t_command_parser_executor::version(const std::vector<std::string>& args)
+{
+ std::cout << "Monero '" << MONERO_RELEASE_NAME << "' (v" << MONERO_VERSION_FULL << ")" << std::endl;
+ return true;
+}
+
} // namespace daemonize
diff --git a/src/daemon/command_parser_executor.h b/src/daemon/command_parser_executor.h
index 2c09a4748..a70070171 100644
--- a/src/daemon/command_parser_executor.h
+++ b/src/daemon/command_parser_executor.h
@@ -138,6 +138,8 @@ public:
bool relay_tx(const std::vector<std::string>& args);
bool sync_info(const std::vector<std::string>& args);
+
+ bool version(const std::vector<std::string>& args);
};
} // namespace daemonize
diff --git a/src/daemon/command_server.cpp b/src/daemon/command_server.cpp
index a50dbea69..144603597 100644
--- a/src/daemon/command_server.cpp
+++ b/src/daemon/command_server.cpp
@@ -280,6 +280,11 @@ t_command_server::t_command_server(
, std::bind(&t_command_parser_executor::sync_info, &m_parser, p::_1)
, "Print information about the blockchain sync state."
);
+ m_command_lookup.set_handler(
+ "version"
+ , std::bind(&t_command_parser_executor::version, &m_parser, p::_1)
+ , "Print version information."
+ );
}
bool t_command_server::process_command_str(const std::string& cmd)
diff --git a/src/daemon/main.cpp b/src/daemon/main.cpp
index 50384b2a6..49494e889 100644
--- a/src/daemon/main.cpp
+++ b/src/daemon/main.cpp
@@ -138,6 +138,28 @@ int main(int argc, char const * argv[])
return 0;
}
+ std::string config = command_line::get_arg(vm, daemon_args::arg_config_file);
+ boost::filesystem::path config_path(config);
+ boost::system::error_code ec;
+ if (bf::exists(config_path, ec))
+ {
+ try
+ {
+ po::store(po::parse_config_file<char>(config_path.string<std::string>().c_str(), core_settings), vm);
+ }
+ catch (const std::exception &e)
+ {
+ // log system isn't initialized yet
+ std::cerr << "Error parsing config file: " << e.what() << std::endl;
+ throw;
+ }
+ }
+ else if (!command_line::is_arg_defaulted(vm, daemon_args::arg_config_file))
+ {
+ std::cerr << "Can't find config file " << config << std::endl;
+ return 1;
+ }
+
const bool testnet = command_line::get_arg(vm, cryptonote::arg_testnet_on);
const bool stagenet = command_line::get_arg(vm, cryptonote::arg_stagenet_on);
if (testnet && stagenet)
@@ -170,29 +192,6 @@ int main(int argc, char const * argv[])
//bf::path relative_path_base = daemonizer::get_relative_path_base(vm);
bf::path relative_path_base = data_dir;
- std::string config = command_line::get_arg(vm, daemon_args::arg_config_file);
-
- boost::filesystem::path data_dir_path(data_dir);
- boost::filesystem::path config_path(config);
- if (!config_path.has_parent_path())
- {
- config_path = data_dir / config_path;
- }
-
- boost::system::error_code ec;
- if (bf::exists(config_path, ec))
- {
- try
- {
- po::store(po::parse_config_file<char>(config_path.string<std::string>().c_str(), core_settings), vm);
- }
- catch (const std::exception &e)
- {
- // log system isn't initialized yet
- std::cerr << "Error parsing config file: " << e.what() << std::endl;
- throw;
- }
- }
po::notify(vm);
// log_file_path