-
Notifications
You must be signed in to change notification settings - Fork 66
/
flags.go
276 lines (271 loc) · 7.78 KB
/
flags.go
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
package main
import (
"github.com/application-research/estuary/config"
"github.com/application-research/estuary/util"
"github.com/mitchellh/go-homedir"
"github.com/urfave/cli/v2"
"path/filepath"
)
func getAppFlags(cfg *config.Estuary) []cli.Flag {
hDir, err := homedir.Dir()
if err != nil {
log.Fatalf("could not determine homedir for estuary app: %+v", err)
}
return []cli.Flag{
util.FlagLogLevel,
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
},
&cli.StringFlag{
Name: "node-api-url",
Value: cfg.Node.ApiURL,
Usage: "lotus api gateway url",
EnvVars: []string{"FULLNODE_API_INFO"},
},
&cli.StringFlag{
Name: "config",
Usage: "specify configuration file location",
Value: filepath.Join(hDir, ".estuary"),
},
&cli.StringFlag{
Name: "database",
Usage: "specify connection string for estuary database",
Value: cfg.DatabaseConnString,
EnvVars: []string{"ESTUARY_DATABASE"},
},
&cli.StringFlag{
Name: "apilisten",
Usage: "address for the api server to listen on",
Value: cfg.ApiListen,
EnvVars: []string{"ESTUARY_API_LISTEN"},
},
&cli.StringFlag{
Name: "announce",
Usage: "announce address for the libp2p server to listen on",
EnvVars: []string{"ESTUARY_ANNOUNCE"},
},
&cli.StringFlag{
Name: "peering-peers",
Usage: "peering addresses for the libp2p server to listen on",
},
&cli.StringFlag{
Name: "datadir",
Usage: "directory to store data in",
Value: cfg.DataDir,
EnvVars: []string{"ESTUARY_DATADIR"},
},
&cli.StringFlag{
Name: "write-log",
Usage: "enable write log blockstore in specified directory",
Value: cfg.Node.WriteLogDir,
Hidden: true,
},
&cli.BoolFlag{
Name: "disable-deals-storage",
Usage: "stops estuary from making new deals and updating existing deals, essentially runs as an ipfs node instead",
Value: cfg.DisableFilecoinStorage,
},
&cli.BoolFlag{
Name: "logging",
Usage: "enable api endpoint logging",
Value: cfg.Logging.ApiEndpointLogging,
},
&cli.BoolFlag{
Name: "disable-auto-retrieve",
Usage: "disables autoretrieve",
Value: cfg.DisableAutoRetrieve,
},
&cli.StringFlag{
Name: "lightstep-token",
Usage: "specify lightstep access token for enabling trace exports",
EnvVars: []string{"ESTUARY_LIGHTSTEP_TOKEN"},
Value: cfg.LightstepToken,
},
&cli.StringFlag{
Name: "hostname",
Usage: "specify hostname this node will be reachable at",
Value: cfg.Hostname,
},
&cli.BoolFlag{
Name: "fail-deals-on-transfer-failure",
Usage: "consider deals failed when the transfer to the miner fails",
Value: cfg.Deal.FailOnTransferFailure,
},
&cli.BoolFlag{
Name: "disable-new-deals",
Usage: "prevents the worker from making any new deals, but existing deals will still be updated/checked",
Value: cfg.Deal.IsDisabled,
},
&cli.BoolFlag{
Name: "disable-swagger-endpoint",
Usage: "do not create the /swagger/* endpoints",
Value: cfg.DisableSwaggerEndpoint,
},
&cli.BoolFlag{
Name: "verified-deal",
Usage: "Defaults to makes deals as verified deal using datacap. Set to false to make deal as regular deal using real FIL(no datacap)",
Value: cfg.Deal.IsVerified,
},
&cli.BoolFlag{
Name: "disable-content-adding",
Usage: "disallow new content ingestion globally",
Value: cfg.Content.DisableGlobalAdding,
},
&cli.BoolFlag{
Name: "disable-local-content-adding",
Usage: "disallow new content ingestion on this node (shuttles are unaffected)",
Value: cfg.Content.DisableLocalAdding,
},
&cli.StringFlag{
Name: "blockstore",
Usage: "specify blockstore parameters",
Value: cfg.Node.Blockstore,
},
&cli.BoolFlag{
Name: "write-log-truncate",
Usage: "enables log truncating",
Value: cfg.Node.WriteLogTruncate,
},
&cli.BoolFlag{
Name: "write-log-flush",
Usage: "enable hard flushing blockstore",
Value: cfg.Node.HardFlushWriteLog,
},
&cli.BoolFlag{
Name: "no-blockstore-cache",
Usage: "disable blockstore caching",
Value: cfg.Node.NoBlockstoreCache,
},
&cli.IntFlag{
Name: "replication",
Usage: "sets replication factor",
Value: cfg.Replication,
},
&cli.BoolFlag{
Name: "lowmem",
Usage: "TEMP: turns down certain parameters to attempt to use less memory (will be replaced by a more specific flag later)",
Value: cfg.LowMem,
},
&cli.BoolFlag{
Name: "jaeger-tracing",
Usage: "enables jaeger tracing",
Value: cfg.Jaeger.EnableTracing,
},
&cli.StringFlag{
Name: "jaeger-provider-url",
Usage: "sets the jaeger provider url",
Value: cfg.Jaeger.ProviderUrl,
},
&cli.Float64Flag{
Name: "jaeger-sampler-ratio",
Usage: "If less than 1 probabilistic metrics will be used.",
Value: cfg.Jaeger.SamplerRatio,
},
&cli.Int64Flag{
Name: "bitswap-max-work-per-peer",
Usage: "sets the bitswap max work per peer",
Value: cfg.Node.Bitswap.MaxOutstandingBytesPerPeer,
},
&cli.IntFlag{
Name: "bitswap-target-message-size",
Usage: "sets the bitswap target message size",
Value: cfg.Node.Bitswap.TargetMessageSize,
},
&cli.IntFlag{
Name: "rpc-incoming-queue-size",
Usage: "sets incoming rpc message queue size",
Value: cfg.RpcEngine.Websocket.IncomingQueueSize,
},
&cli.IntFlag{
Name: "rpc-outgoing-queue-size",
Usage: "sets outgoing rpc message queue size",
Value: cfg.RpcEngine.Websocket.OutgoingQueueSize,
},
&cli.IntFlag{
Name: "rpc-queue-handlers",
Usage: "sets rpc message handler count",
Value: cfg.RpcEngine.Websocket.QueueHandlers,
},
&cli.BoolFlag{
Name: "queue-eng-enabled",
Usage: "enable queue engine for rpc",
Value: cfg.RpcEngine.Queue.Enabled,
},
&cli.IntFlag{
Name: "queue-eng-consumers",
Usage: "sets number of consumers per topic",
Value: cfg.RpcEngine.Queue.Consumers,
},
&cli.StringFlag{
Name: "queue-eng-driver",
Usage: "sets the type of queue",
Value: cfg.RpcEngine.Queue.Driver,
},
&cli.StringFlag{
Name: "queue-eng-host",
Usage: "sets the host address for the queue",
Value: cfg.RpcEngine.Queue.Host,
},
&cli.BoolFlag{
Name: "staging-bucket",
Usage: "enable staging bucket",
Value: cfg.StagingBucket.Enabled,
},
&cli.StringSliceFlag{
Name: "deal-protocol-version",
Usage: "sets the deal protocol version. defaults to v110 (go-fil-markets) and v120 (boost)",
},
&cli.StringFlag{
Name: "indexer-url",
Usage: "sets the indexer advertisement url",
Value: cfg.Node.IndexerURL,
},
&cli.StringFlag{
Name: "indexer-advertisement-interval",
Usage: "sets the indexer advertisement interval using a Go time string (e.g. '1m30s')",
Value: cfg.Node.IndexerAdvertisementInterval.String(),
},
&cli.BoolFlag{
Name: "advertise-offline-autoretrieves",
Usage: "if set, registered autoretrieves will be advertised even if they are not currently online",
},
&cli.StringFlag{
Name: "max-price",
Usage: "sets the max price for non-verified deals",
Value: cfg.Deal.MaxPrice.String(),
},
&cli.StringFlag{
Name: "max-verified-price",
Usage: "sets the max price for verified deals",
Value: cfg.Deal.MaxVerifiedPrice.String(),
},
}
}
func getSetupFlags(cfg *config.Estuary) []cli.Flag {
hDir, err := homedir.Dir()
if err != nil {
log.Fatalf("could not determine homedir for estuary app: %+v", err)
}
return []cli.Flag{
&cli.StringFlag{
Name: "username",
Usage: "specify setup username",
},
&cli.StringFlag{
Name: "password",
Usage: "specify setup password",
},
&cli.StringFlag{
Name: "config",
Usage: "specify configuration file location",
Value: filepath.Join(hDir, ".estuary"),
},
&cli.StringFlag{
Name: "database",
Usage: "specify connection string for estuary database",
Value: cfg.DatabaseConnString,
EnvVars: []string{"ESTUARY_DATABASE"},
},
}
}