mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-21 12:15:54 +00:00
feat: Migration framework (#1768)
This PR implemented the migration framework, which contains the command line interface to execute migration and helps to migrate data easily. Please read README.md for more information about this framework.
This commit is contained in:
@@ -19,8 +19,10 @@
|
||||
|
||||
#include "app/CliArgs.hpp"
|
||||
#include "app/ClioApplication.hpp"
|
||||
#include "migration/MigrationApplication.hpp"
|
||||
#include "rpc/common/impl/HandlerProvider.hpp"
|
||||
#include "util/TerminationHandler.hpp"
|
||||
#include "util/config/Config.hpp"
|
||||
#include "util/log/Logger.hpp"
|
||||
#include "util/newconfig/ConfigDefinition.hpp"
|
||||
#include "util/newconfig/ConfigFileJson.hpp"
|
||||
@@ -54,6 +56,22 @@ try {
|
||||
util::LogService::init(ClioConfig);
|
||||
app::ClioApplication clio{ClioConfig};
|
||||
return clio.run(run.useNgWebServer);
|
||||
},
|
||||
[](app::CliArgs::Action::Migrate const& migrate) {
|
||||
auto const json = ConfigFileJson::make_ConfigFileJson(migrate.configPath);
|
||||
if (!json.has_value()) {
|
||||
std::cerr << json.error().error << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
auto const errors = ClioConfig.parse(json.value());
|
||||
if (errors.has_value()) {
|
||||
for (auto const& err : errors.value())
|
||||
std::cerr << err.error << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
util::LogService::init(ClioConfig);
|
||||
app::MigratorApplication migrator{ClioConfig, migrate.subCmd};
|
||||
return migrator.run();
|
||||
}
|
||||
);
|
||||
} catch (std::exception const& e) {
|
||||
|
||||
Reference in New Issue
Block a user