Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support xenial builds #398

Merged
merged 1 commit into from May 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/xrouter/xrouterapp.cpp
Expand Up @@ -86,7 +86,7 @@ bool App::createConf()
#endif
auto p = GetDataDir(false) / "xrouter.conf";
if (!boost::filesystem::exists(p)) {
boost::filesystem::save_string_file(p,
saveConf(p,
"[Main]" + eol +
"#! maxfee is the maximum fee (in BLOCK) you're willing to pay on a single xrouter call" + eol +
"#! 0 means you only want free calls" + eol +
Expand Down Expand Up @@ -120,7 +120,7 @@ bool App::createConf()
if (!boost::filesystem::exists(plugins)) {
boost::filesystem::create_directory(plugins);
auto samplerpc = plugins / "ExampleRPC.conf";
boost::filesystem::save_string_file(samplerpc,
saveConf(samplerpc,
"#! ExampleRPC is a sample rpc plugin. This entire plugin configuration is sent to the client." + eol +
"#! Any lines beginning with #! will not be sent to the client." + eol +
"#! Any config parameters beginning with private:: will not be sent to the client." + eol +
Expand Down Expand Up @@ -156,7 +156,7 @@ bool App::createConf()
"disabled=1" + eol
);
auto sampledocker = plugins / "ExampleDocker.conf";
boost::filesystem::save_string_file(sampledocker,
saveConf(sampledocker,
"#! ExampleDocker is a sample docker plugin. This entire plugin configuration is sent to the client." + eol +
"#! Any lines beginning with #! will not be sent to the client." + eol +
"#! Any config parameters beginning with private:: will not be sent to the client." + eol +
Expand Down
14 changes: 13 additions & 1 deletion src/xrouter/xrouterapp.h
Expand Up @@ -24,6 +24,8 @@
#include <boost/asio.hpp>
#include <boost/bind.hpp>
#include <boost/thread.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/filesystem/operations.hpp>

#include <memory>
#include <chrono>
Expand Down Expand Up @@ -65,7 +67,17 @@ class App
* @return true if created otherwise false
*/
static bool createConf();


/**
* Save configuration files to the specified path.
*/
static void saveConf(const boost::filesystem::path& p, const std::string& str) {
boost::filesystem::ofstream file;
file.exceptions(std::ofstream::failbit | std::ofstream::badbit);
file.open(p, std::ios_base::binary);
file.write(str.c_str(), str.size());
}

/**
* @brief XRouter settings
* @return local xrouter.conf settings
Expand Down