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

Backported code to preemptively create wallet dir #223

Merged
merged 1 commit into from
May 13, 2022
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions plugins/wallet_plugin/wallet_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ void wallet_plugin::plugin_initialize(const variables_map& options) {
if (options.count("wallet-dir")) {
auto dir = options.at("wallet-dir").as<boost::filesystem::path>();
if (dir.is_relative())
wallet_manager_ptr->set_dir(app().data_dir() / dir);
else
wallet_manager_ptr->set_dir(dir);
dir = app().data_dir() / dir;
if( !bfs::exists(dir) )
ClaytonCalabrese marked this conversation as resolved.
Show resolved Hide resolved
bfs::create_directories(dir);
wallet_manager_ptr->set_dir(dir);
}
if (options.count("unlock-timeout")) {
auto timeout = options.at("unlock-timeout").as<int64_t>();
Expand Down
9 changes: 7 additions & 2 deletions programs/keosd/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,13 @@ int main(int argc, char** argv)
.default_http_port = 0
});
app().register_plugin<wallet_api_plugin>();
if(!app().initialize<wallet_plugin, wallet_api_plugin, http_plugin>(argc, argv))
return -1;
if(!app().initialize<wallet_plugin, wallet_api_plugin, http_plugin>(argc, argv)) {
const auto &opts = app().get_options();
if (opts.count("help") || opts.count("version") || opts.count("full-version") ||
ClaytonCalabrese marked this conversation as resolved.
Show resolved Hide resolved
opts.count("print-default-config")) {
return 0;
}
}
initialize_logging();
auto& http = app().get_plugin<http_plugin>();
http.add_handler("/v1/" + keosd::config::key_store_executable_name + "/stop", [&a=app()](string, string, url_response_callback cb) { cb(200, fc::variant(fc::variant_object())); a.quit(); } );
Expand Down