diff --git a/services/tunnelbroker/src/server.cpp b/services/tunnelbroker/src/server.cpp index 46bee5ac0..7882da895 100644 --- a/services/tunnelbroker/src/server.cpp +++ b/services/tunnelbroker/src/server.cpp @@ -1,49 +1,55 @@ #include "AmqpManager.h" #include "ConfigManager.h" #include "Constants.h" +#include "GlobalTools.h" #include "TunnelbrokerServiceImpl.h" #include #include #include #include #include namespace comm { namespace network { void RunServer() { TunnelBrokerServiceImpl service; grpc::EnableDefaultHealthCheckService(true); grpc::ServerBuilder builder; // Listen on the given address without any authentication mechanism. builder.AddListeningPort( SERVER_LISTEN_ADDRESS, grpc::InsecureServerCredentials()); // Register "service" as the instance through which we'll communicate with // clients. In this case it corresponds to an *synchronous* service. builder.RegisterService(&service); std::unique_ptr server(builder.BuildAndStart()); LOG(INFO) << "gRPC Server listening at :" << SERVER_LISTEN_ADDRESS; // Wait for the server to shutdown. Note that some other thread must be // responsible for shutting down the server for this call to ever return. server->Wait(); } void RunAmqpClient() { AmqpManager::getInstance().connect(); } } // namespace network } // namespace comm int main(int argc, char **argv) { google::InitGoogleLogging(argv[0]); - comm::network::config::ConfigManager::getInstance().load( - comm::network::CONFIG_FILE_PATH); + if (comm::network::tools::isDevMode()) { + comm::network::config::ConfigManager::getInstance().load( + comm::network::DEV_CONFIG_FILE_PATH); + } else { + comm::network::config::ConfigManager::getInstance().load( + comm::network::CONFIG_FILE_PATH); + } std::thread amqpThread(comm::network::RunAmqpClient); std::thread grpcThread(comm::network::RunServer); amqpThread.join(); grpcThread.join(); return 0; }