Skip to content

Commit

Permalink
Add support for setting the receiver proxy flags via environment vari…
Browse files Browse the repository at this point in the history
…ables

Signed-off-by: bakhtin <[email protected]>
  • Loading branch information
bakhtin committed Nov 1, 2024
1 parent 148e247 commit e6f5aef
Showing 1 changed file with 68 additions and 51 deletions.
119 changes: 68 additions & 51 deletions cmd/receiver-proxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,93 +21,110 @@ import (
var flags []cli.Flag = []cli.Flag{
// input and output
&cli.StringFlag{
Name: "local-listen-addr",
Value: "127.0.0.1:443",
Usage: "address to listen on for orderflow proxy API for external users and local operator",
Name: "local-listen-addr",
Value: "127.0.0.1:443",
Usage: "address to listen on for orderflow proxy API for external users and local operator",
EnvVars: []string{"LOCAL_LISTEN_ADDR"},
},
&cli.StringFlag{
Name: "public-listen-addr",
Value: "127.0.0.1:5544",
Usage: "address to listen on for orderflow proxy API for other network participants",
Name: "public-listen-addr",
Value: "127.0.0.1:5544",
Usage: "address to listen on for orderflow proxy API for other network participants",
EnvVars: []string{"PUBLIC_LISTEN_ADDR"},
},
&cli.StringFlag{
Name: "cert-listen-addr",
Value: "127.0.0.1:14727",
Usage: "address to listen on for orderflow proxy serving its SSL certificate on /cert",
Name: "cert-listen-addr",
Value: "127.0.0.1:14727",
Usage: "address to listen on for orderflow proxy serving its SSL certificate on /cert",
EnvVars: []string{"CERT_LISTEN_ADDR"},
},
&cli.StringFlag{
Name: "builder-endpoint",
Value: "http://127.0.0.1:8645",
Usage: "address to send local ordeflow to",
Name: "builder-endpoint",
Value: "http://127.0.0.1:8645",
Usage: "address to send local ordeflow to",
EnvVars: []string{"BUILDER_ENDPOINT"},
},
&cli.StringFlag{
Name: "rpc-endpoint",
Value: "http://127.0.0.1:8545",
Usage: "address of the node RPC that supports eth_blockNumber",
Name: "rpc-endpoint",
Value: "http://127.0.0.1:8545",
Usage: "address of the node RPC that supports eth_blockNumber",
EnvVars: []string{"RPC_ENDPOINT"},
},
&cli.StringFlag{
Name: "builder-confighub-endpoint",
Value: "http://127.0.0.1:14892",
Usage: "address of the builder config hub enpoint (directly or throught the cvm-proxy)",
Name: "builder-confighub-endpoint",
Value: "http://127.0.0.1:14892",
Usage: "address of the builder config hub enpoint (directly or throught the cvm-proxy)",
EnvVars: []string{"BUILDER_CONFIGHUB_ENDPOINT"},
},
&cli.StringFlag{
Name: "orderflow-archive-endpoint",
Value: "http://127.0.0.1:14893",
Usage: "address of the ordreflow archive endpoint (block-processor)",
Name: "orderflow-archive-endpoint",
Value: "http://127.0.0.1:14893",
Usage: "address of the ordreflow archive endpoint (block-processor)",
EnvVars: []string{"ORDERFLOW_ARCHIVE_ENDPOINT"},
},
&cli.StringFlag{
Name: "flashbots-orderflow-signer-address",
Value: "0x5015Fa72E34f75A9eC64f44a4Fcf0837919D1bB7",
Usage: "ordreflow from Flashbots will be signed with this address",
Name: "flashbots-orderflow-signer-address",
Value: "0x5015Fa72E34f75A9eC64f44a4Fcf0837919D1bB7",
Usage: "ordreflow from Flashbots will be signed with this address",
EnvVars: []string{"FLASHBOTS_ORDERFLOW_SIGNER_ADDRESS"},
},
&cli.Int64Flag{
Name: "max-request-body-size-bytes",
Value: 0,
Usage: "Maximum size of the request body, if 0 default will be used",
Name: "max-request-body-size-bytes",
Value: 0,
Usage: "Maximum size of the request body, if 0 default will be used",
EnvVars: []string{"MAX_REQUEST_BODY_SIZE_BYTES"},
},

// certificate config
&cli.DurationFlag{
Name: "cert-duration",
Value: time.Hour * 24 * 365,
Usage: "generated certificate duration",
Name: "cert-duration",
Value: time.Hour * 24 * 365,
Usage: "generated certificate duration",
EnvVars: []string{"CERT_DURATION"},
},
&cli.StringSliceFlag{
Name: "cert-hosts",
Value: cli.NewStringSlice("127.0.0.1", "localhost"),
Usage: "generated certificate hosts",
Name: "cert-hosts",
Value: cli.NewStringSlice("127.0.0.1", "localhost"),
Usage: "generated certificate hosts",
EnvVars: []string{"CERT_HOSTS"},
},

// logging, metrics and debug
&cli.StringFlag{
Name: "metrics-addr",
Value: "127.0.0.1:8090",
Usage: "address to listen on for Prometheus metrics (metrics are served on $metrics-addr/metrics)",
Name: "metrics-addr",
Value: "127.0.0.1:8090",
Usage: "address to listen on for Prometheus metrics (metrics are served on $metrics-addr/metrics)",
EnvVars: []string{"METRICS_ADDR"},
},
&cli.BoolFlag{
Name: "log-json",
Value: false,
Usage: "log in JSON format",
Name: "log-json",
Value: false,
Usage: "log in JSON format",
EnvVars: []string{"LOG_JSON"},
},
&cli.BoolFlag{
Name: "log-debug",
Value: false,
Usage: "log debug messages",
Name: "log-debug",
Value: false,
Usage: "log debug messages",
EnvVars: []string{"LOG_DEBUG"},
},
&cli.BoolFlag{
Name: "log-uid",
Value: false,
Usage: "generate a uuid and add to all log messages",
Name: "log-uid",
Value: false,
Usage: "generate a uuid and add to all log messages",
EnvVars: []string{"LOG_UID"},
},
&cli.StringFlag{
Name: "log-service",
Value: "tdx-orderflow-proxy-receiver",
Usage: "add 'service' tag to logs",
Name: "log-service",
Value: "tdx-orderflow-proxy-receiver",
Usage: "add 'service' tag to logs",
EnvVars: []string{"LOG_SERVICE"},
},
&cli.BoolFlag{
Name: "pprof",
Value: false,
Usage: "enable pprof debug endpoint (pprof is served on $metrics-addr/debug/pprof/*)",
Name: "pprof",
Value: false,
Usage: "enable pprof debug endpoint (pprof is served on $metrics-addr/debug/pprof/*)",
EnvVars: []string{"PPROF"},
},
}

Expand Down

0 comments on commit e6f5aef

Please sign in to comment.