rewrite MccGenericMount and MccGenericFsmMount class creation
Asibfm700MountNetServer is now started
This commit is contained in:
@@ -27,6 +27,12 @@ int main(int argc, char* argv[])
|
||||
options.add_options()("level", "Log level (see SPDLOG package description for valid values)",
|
||||
cxxopts::value<std::string>()->default_value("info"));
|
||||
|
||||
options.add_options()("c,config", "Mount configuration filename (by default use of hardcoded one)",
|
||||
cxxopts::value<std::string>()->default_value(""));
|
||||
|
||||
options.add_options()("dump", "Dump mount default configuration to file and exit",
|
||||
cxxopts::value<std::string>()->default_value(""));
|
||||
|
||||
options.add_options()(
|
||||
"endpoints",
|
||||
"endpoints server will be listening for. For 'local' endpoint the '@' symbol at the beginning of the path "
|
||||
@@ -54,6 +60,19 @@ int main(int argc, char* argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
asibfm700::Asibfm700MountConfig mount_cfg;
|
||||
|
||||
std::string fname = opt_result["dump"].as<std::string>();
|
||||
if (fname.size()) {
|
||||
bool ok = mount_cfg.dumpDefaultsToFile(fname);
|
||||
if (!ok) {
|
||||
return 255;
|
||||
}
|
||||
|
||||
return 0;
|
||||
} else {
|
||||
return 255;
|
||||
}
|
||||
|
||||
auto logname = opt_result["log"].as<std::string>();
|
||||
|
||||
@@ -91,7 +110,18 @@ int main(int argc, char* argv[])
|
||||
logger->info("\n");
|
||||
|
||||
|
||||
asibfm700::Asibfm700MountConfig mount_cfg;
|
||||
|
||||
std::string mount_cfg_fname = opt_result["config"].as<std::string>();
|
||||
if (mount_cfg_fname.size()) {
|
||||
logger->info("Try to load mount configuration from file: {}", mount_cfg_fname);
|
||||
auto err = mount_cfg.load(mount_cfg_fname);
|
||||
if (err) {
|
||||
logger->error("Cannot load mount configuration (err = {})! Use defaults!", err.message());
|
||||
} else {
|
||||
logger->info("Mount configuration was loaded successfully!");
|
||||
}
|
||||
}
|
||||
|
||||
asibfm700::Asibfm700Mount mount(mount_cfg, logger);
|
||||
asibfm700::Asibfm700MountNetServer server(ctx, mount, logger);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user