59 lines
1.8 KiB
C++
59 lines
1.8 KiB
C++
#include "Web.h"
|
|
|
|
#include "lib/config/config.h"
|
|
#include "lib/config/protos/quickbus_cfg.pb.h"
|
|
#include "lib/config/protos/Ports.pb.h"
|
|
#include "lib/quickbus/quickbus.h"
|
|
#include "lib/api/public/ServiceContext.h"
|
|
|
|
#include "lib/metrics/metrics.h"
|
|
#include "lib/metrics/system_metrics.h"
|
|
#include "server/sparkd/http/WebServer.h"
|
|
#include "lib/md/relay/QueryServer.h"
|
|
#include "lib/md/MDClient.h"
|
|
#include "lib/md/SyntheticSecurityService.h"
|
|
#include "server/sparkd/user/AdminServiceServer.h"
|
|
#include "server/sparkd/user/AuthServiceServer.h"
|
|
#include "server/sparkd/md/run_md.h"
|
|
#include "lib/tracing/PerfLog.h"
|
|
|
|
#include <vector>
|
|
#include <string>
|
|
|
|
namespace bts {
|
|
namespace cmd {
|
|
|
|
int Web::execute(const std::vector<std::string>& args) {
|
|
config::QuickbusNodeCfg qb_cfg;
|
|
auto& ports = config::get<config::Ports>();
|
|
qb_cfg.set_my_port(ports.qbus_port());
|
|
qbus::Quickbus quickbus(qb_cfg);
|
|
api::ServiceContext sc(&quickbus);
|
|
|
|
metrics::MetricsContainer stats;
|
|
metrics::publish_system_metrics(stats);
|
|
trace::PerfLog perf_log;
|
|
http::SparkWebServer webserver(sc, stats, perf_log,ports.config_port());
|
|
|
|
user::AuthServiceServer login_server(sc);
|
|
if (std::find(args.begin(), args.end(), "-md") != args.end()) {
|
|
md::run_market_datapublishers(nullptr);
|
|
}
|
|
|
|
api::synthetic::SyntheticSecurityService synthetic_service(sc);
|
|
md::MDClient mdclient(&utils::Dispatcher::current(), &synthetic_service);
|
|
md::QueryServerPtr md_query_server(
|
|
md::run_query_server(sc, mdclient, stats));
|
|
|
|
admin::AdminServiceServer admin_service(sc);
|
|
|
|
utils::Dispatcher::current().run();
|
|
return 0;
|
|
}
|
|
|
|
std::string Web::help() {
|
|
return "\t run only the services required for the web admin. This cannot be run concurrently with 'sparkd run'\n\tAdd -md to start market data too.";
|
|
}
|
|
|
|
}}//namespace
|