forked from irods/irods_client_rest_cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ListApiMainServer.cpp
52 lines (41 loc) · 1.19 KB
/
ListApiMainServer.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/**
* iRODS REST API
* This is the iRODS REST API
*
* OpenAPI spec version: 1.0.0
* Contact: info@irods.org
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include "ListApiImpl.h"
#include "logger.hpp"
using namespace io::swagger::server::api;
// clang-format off
namespace ir = irods::rest;
namespace irck = irods::rest::configuration_keywords;
// clang-format on
int main()
{
auto cfg = ir::configuration{ir::service_name};
auto logger = ir::init_logger(ir::service_name, cfg);
auto port = cfg[irck::port];
if (port.empty()) {
logger->error("Port is not configured for service.");
return 3;
}
auto threads = cfg[irck::threads];
if (threads.empty()) {
logger->info("Using default number of threads [4].");
threads = 4;
}
auto addr = Pistache::Address(Pistache::Ipv4::any(), Pistache::Port(port.get<int>()));
auto server = ListApiImpl(addr);
server.init(threads.get<int>());
server.start();
server.shutdown();
}