Add cli flags

This commit is contained in:
Mak Muftic 2021-09-24 12:37:16 +02:00
parent 0c390d12f7
commit e46da5a181
4 changed files with 47 additions and 0 deletions

View File

@ -153,6 +153,22 @@ var DaemonCmd = &cli.Command{
Name: "restore-config",
Usage: "config file to use when restoring from backup",
},
&cli.StringFlag{
Name: "trace-to-json",
Usage: "starts tracer and outputs to json file defined with this flag",
},
&cli.StringFlag{
Name: "trace-to-elasticsearch",
Usage: "starts tracer and outputs to elasticsearch, flag must contain connection string for elasticsearch",
},
&cli.StringFlag{
Name: "elasticsearch-index",
Usage: "configure elasticearch index name if elasticsearch tracer is configured",
},
&cli.StringFlag{
Name: "trace-source-auth",
Usage: "auth token for trusted source of traces",
},
},
Action: func(cctx *cli.Context) error {
isLite := cctx.Bool("lite")
@ -193,6 +209,14 @@ var DaemonCmd = &cli.Command{
return fmt.Errorf("unrecognized profile type: %q", profile)
}
traceToJsonFile := cctx.String("trace-to-json")
traceToElasticsearch := cctx.String("trace-to-elasticsearch")
elasticsearchIndex := cctx.String("elasticsearch-index")
traceSourceAuth := cctx.String("trace-source-auth")
ctx, _ := tag.New(context.Background(),
tag.Insert(metrics.Version, build.BuildVersion),
tag.Insert(metrics.Commit, build.CurrentCommit),
@ -319,6 +343,10 @@ var DaemonCmd = &cli.Command{
node.Override(new(dtypes.Bootstrapper), isBootstrapper),
node.Override(new(dtypes.ShutdownChan), shutdownChan),
node.Override(new(dtypes.JsonTracerFile), traceToJsonFile),
node.Override(new(dtypes.ElasticSearchTracer), traceToElasticsearch),
node.Override(new(dtypes.ElasticSearchTracer), elasticsearchIndex),
node.Override(new(dtypes.TracerSourceAuth), traceSourceAuth),
genesis,
liteModeDeps,

View File

@ -537,6 +537,18 @@ Type: Array of multiaddress peerinfo strings, must include peerid (/p2p/12D3K...
Name: "ElasticSearchTracer",
Type: "string",
Comment: ``,
},
{
Name: "ElasticSearchIndex",
Type: "string",
Comment: ``,
},
{
Name: "TracerSourceAuth",
Type: "string",
Comment: ``,
},
},

View File

@ -311,6 +311,7 @@ type Pubsub struct {
RemoteTracer string
JsonTracerFile string
ElasticSearchTracer string
ElasticSearchIndex string
TracerSourceAuth string
}

View File

@ -0,0 +1,6 @@
package dtypes
type JsonTracerFile string
type ElasticSearchTracer string
type ElasticSearchIndex string
type TracerSourceAuth string