forked from ydb-platform/nbs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptions.cpp
70 lines (53 loc) · 2 KB
/
options.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include "options.h"
namespace NCloud::NBlockStore::NServer {
using namespace NLastGetopt;
////////////////////////////////////////////////////////////////////////////////
TOptions::TOptions()
{
Opts.AddLongOption("storage-file")
.RequiredArgument("FILE")
.StoreResult(&StorageConfig);
Opts.AddLongOption("disk-agent-file")
.RequiredArgument("FILE")
.StoreResult(&DiskAgentConfig);
Opts.AddLongOption("dr-proxy-file")
.RequiredArgument("FILE")
.StoreResult(&DiskRegistryProxyConfig);
Opts.AddLongOption("features-file")
.RequiredArgument("FILE")
.StoreResult(&FeaturesConfig);
Opts.AddLongOption("rdma-file")
.RequiredArgument("FILE")
.DefaultValue("")
.StoreResult(&RdmaConfig);
Opts.AddLongOption("syslog-service")
.RequiredArgument("STR")
.StoreResult(&SysLogService);
Opts.AddLongOption("node-type")
.RequiredArgument("STR")
.DefaultValue("disk-agent")
.StoreResult(&NodeType);
Opts.AddLongOption(
"temporary-agent",
"run temporary disk agent for blue-green deployment")
.NoArgument()
.StoreTrue(&TemporaryAgent);
Opts.AddLongOption("rdma-target-port")
.RequiredArgument("NUM")
.DefaultValue(0)
.StoreResult(&RdmaTargetPort);
}
void TOptions::Parse(int argc, char** argv)
{
auto res = std::make_unique<TOptsParseResultException>(&Opts, argc, argv);
if (res->FindLongOptParseResult("verbose") != nullptr && !VerboseLevel) {
VerboseLevel = "debug";
}
Y_ENSURE(res->FindLongOptParseResult("ic-port"),
"'--ic-port' option is required for kikimr service");
Y_ENSURE(res->FindLongOptParseResult("domain"),
"'--domain' option is required for kikimr service");
Y_ENSURE(SysConfig && DomainsConfig || LoadCmsConfigs,
"sys-file and domains-file options are required if load-configs-from-cms is not set");
}
} // namespace NCloud::NBlockStore::NServer