-
Notifications
You must be signed in to change notification settings - Fork 22
/
cliflags.ts
156 lines (145 loc) · 5.95 KB
/
cliflags.ts
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
import { flags } from '@oclif/command';
import { StartBlock } from './blockwatcher';
export const CLI_FLAGS = {
version: flags.version({ char: 'v' }),
help: flags.help({ char: 'h' }),
debug: flags.boolean({
description: 'Enable debug log output',
}),
trace: flags.boolean({
description:
'Enable trace output (very, very verbose). ' +
'Output will include raw payloads sent and received via JSON RPC and HEC',
exclusive: ['debug'],
}),
'print-config': flags.boolean({
description:
'Causes ethlogger to simply print the configuration merged from config file and CLI flags and exit.',
}),
'health-check': flags.boolean({
hidden: true,
description:
'Performs health check for a running ethlogger process by examining the state file created by that process',
}),
'config-file': flags.string({
char: 'c',
description:
'Ethlogger configuration file to use. If not specfified ethlogger will look for a file ' +
'called ethlogger.yaml or ethlogger.json in the current working directory',
}),
'collect-blocks': flags.boolean({
allowNo: true,
env: 'COLLECT_BLOCKS',
description:
'Enables ethereum block watcher, ingesting blocks, transactions, event logs ' +
'and ABI-decoded information from method calls and event logs',
}),
'collect-node-metrics': flags.boolean({
allowNo: true,
env: 'COLLECT_NODE_METRICS',
description: 'Enables collection of node metrics',
}),
'collect-node-info': flags.boolean({
allowNo: true,
env: 'COLLECT_NODE_INFO',
description: 'Enables collection of node info events',
}),
'collect-internal-metrics': flags.boolean({
allowNo: true,
env: 'COLLECT_INTERNAL_METRICS',
description: 'Enables collection of ethlogger-internal metrics',
}),
'hec-url': flags.string({
env: 'SPLUNK_HEC_URL',
description:
'URL to connect to Splunk HTTP Event Collector. ' +
'You can either specify just the base URL (without path) ' +
'and the default path will automatically appended or a full URL',
}),
'hec-token': flags.string({
env: 'SPLUNK_HEC_TOKEN',
description: 'Token to authenticate against Splunk HTTP Event Collector',
}),
'hec-reject-invalid-certs': flags.boolean({
allowNo: true,
env: 'SPLUNK_HEC_REJECT_INVALID_CERTS',
description:
'Disable to allow HEC client to connect to HTTPS without rejecting invalid (self-signed) certificates',
}),
'hec-events-index': flags.string({
env: 'SPLUNK_EVENTS_INDEX',
description:
'Splunk index to send events to. You can alternatively use separate HEC tokens to correctly route your data',
}),
'hec-metrics-index': flags.string({
env: 'SPLUNK_METRICS_INDEX',
description:
'Splunk index to send metrics to. You can alternatively use separate HEC tokens to correctly route your data',
}),
'hec-internal-index': flags.string({
env: 'SPLUNK_INTERNAL_INDEX',
description:
'Splunk index to send internal metrics to. You can alternatively use separate HEC tokens to correctly route your data',
}),
'hec-events-token': flags.string({
env: 'SPLUNK_EVENTS_HEC_TOKEN',
description:
'HEC token to use for sending events. You can alternatively configure different indexes to correctly route your data',
}),
'hec-metrics-token': flags.string({
env: 'SPLUNK_METRICS_HEC_TOKEN',
description:
'HEC token to use for sending metrics. You can alternatively configure different indexes to correctly route your data',
}),
'hec-internal-token': flags.string({
env: 'SPLUNK_INTERNAL_HEC_TOKEN',
description:
'HEC token to use for sending internal metrics. You can alternatively configure different indexes to correctly route your data',
}),
'eth-rpc-url': flags.string({
env: 'ETH_RPC_URL',
description: 'URL to reach the target ethereum node. Supported format is currently only HTTP(s) for JSON RPC',
}),
'eth-reject-invalid-certs': flags.boolean({
allowNo: true,
env: 'ETH_REJECT_INVALID_CERTS',
description:
'Disable to allow ethereum client to connect to HTTPS without rejecting invalid (self-signed) certificates',
}),
'abi-dir': flags.string({
env: 'ABI_DIR',
description: 'Directory containing ABI definitions (JSON files). This directory will be searched recursively',
}),
'start-at-block': flags.option<StartBlock>({
env: 'START_AT_BLOCK',
multiple: false,
helpValue: 'genesis|latest|<number>',
description:
'First block to start ingesting from. ' +
'Possible values are "genesis", "latest", an absolute block number ' +
'or a negative number describing how many blocks before the latest one to start at',
parse: s => {
if (s === 'genesis' || s === 'latest') {
return s;
}
const n = parseInt(s, 10);
if (isNaN(n)) {
throw new Error(`Invalid start block: ${JSON.stringify(s)}`);
}
if (n % 1 !== 0) {
throw new Error(`Invalid start block: ${JSON.stringify(s)} - block number must be an integer`);
}
return n;
},
}),
'reject-invalid-certs': flags.boolean({
env: 'REJECT_INVALID_CERTS',
allowNo: true,
description:
'Disable to allow all HTTP clients (HEC and ETH) to connect to HTTPS without rejecting invalid (self-signed) certificates',
}),
'network-name': flags.string({
env: 'NETWORK_NAME',
description: 'The network name will be attached to all events sent to Splunk',
}),
};