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
|
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/defaults.h>
#include <stdio.h>
#include <string.h>
int main(int argc, char **argv) {
if (argc != 2) {
fprintf(stderr, "usage: %s <variable>\n", argv[0]);
fprintf(stderr, " the variable must be 'home' or 'portbase' currently\n");
return 1;
}
if (strcmp(argv[1], "home") == 0) {
printf("%s\n", vespa::Defaults::vespaHome());
} else if (strcmp(argv[1], "user") == 0) {
printf("%s\n", vespa::Defaults::vespaUser());
} else if (strcmp(argv[1], "portbase") == 0) {
printf("%d\n", vespa::Defaults::vespaPortBase());
} else if (strcmp(argv[1], "configserver_rpc_port") == 0) {
printf("%d\n", vespa::Defaults::vespaConfigServerRpcPort());
} else if (strcmp(argv[1], "configservers") == 0) {
for (std::string v : vespa::Defaults::vespaConfigServerHosts()) {
printf("%s\n", v.c_str());
}
} else if (strcmp(argv[1], "configservers_rpc") == 0) {
size_t count = 0;
for (std::string v : vespa::Defaults::vespaConfigServerRpcAddrs()) {
if (count++ > 0) printf(",");
printf("%s", v.c_str());
}
printf("\n");
} else if (strcmp(argv[1], "configservers_http") == 0) {
for (std::string v : vespa::Defaults::vespaConfigServerRestUrls()) {
printf("%s\n", v.c_str());
}
} else if (strcmp(argv[1], "configsources") == 0) {
size_t count = 0;
for (std::string v : vespa::Defaults::vespaConfigSourcesRpcAddrs()) {
if (count++ > 0) printf(",");
printf("%s", v.c_str());
}
printf("\n");
} else if (strcmp(argv[1], "configproxy_rpc") == 0) {
std::string v = vespa::Defaults::vespaConfigProxyRpcAddr();
printf("%s\n", v.c_str());
} else {
fprintf(stderr, "Unknown variable '%s'\n", argv[1]);
return 1;
}
return 0;
}
|