forked from irods/irods_client_rest_cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
StreamGetApiMainServer.cpp
50 lines (39 loc) · 1.16 KB
/
StreamGetApiMainServer.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
/**
* 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 "StreamGetApiImpl.h"
#include "logger.hpp"
using namespace io::swagger::server::api;
namespace ir = irods::rest;
namespace irck = irods::rest::configuration_keywords;
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 = StreamGetApiImpl(addr);
server.init(threads.get<int>());
server.start();
server.shutdown();
}