Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print set config values on node start #2616

Merged
merged 3 commits into from
Oct 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#### CLI

#### General
- [#2616](https://github.com/livepeer/go-livepeer/pull/2616) cmd: Echo explicitly set config values on node start
- [#2583](https://github.com/livepeer/go-livepeer/pull/2583) eth: Set tx GasFeeCap to min(gasPriceEstimate, current GasFeeCap) (@yondonfu)
- [#2586](https://github.com/livepeer/go-livepeer/pull/2586) Broadcaster: Don't pass a nil context into grpc call or it panics (@thomshutt, @cyberj0g)

Expand Down
19 changes: 18 additions & 1 deletion cmd/livepeer/livepeer.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import (
"context"
"flag"
"fmt"
"github.com/olekukonko/tablewriter"
"os"
"os/signal"
"reflect"
"runtime"
"time"

Expand Down Expand Up @@ -48,9 +50,24 @@ func main() {
}

vFlag.Value.Set(*verbosity)

cfg = updateNilsForUnsetFlags(cfg)

// compare current settings with default values, and print the difference
defCfg := starter.DefaultLivepeerConfig()
vDefCfg := reflect.ValueOf(defCfg)
vCfg := reflect.ValueOf(cfg)
cfgType := vCfg.Type()
paramTable := tablewriter.NewWriter(os.Stdout)
for i := 0; i < cfgType.NumField(); i++ {
if !vDefCfg.Field(i).IsNil() && !vCfg.Field(i).IsNil() && vCfg.Field(i).Elem().Interface() != vDefCfg.Field(i).Elem().Interface() {
paramTable.Append([]string{cfgType.Field(i).Name, fmt.Sprintf("%v", vCfg.Field(i).Elem())})
}
}
paramTable.SetAlignment(tablewriter.ALIGN_LEFT)
paramTable.SetCenterSeparator("*")
paramTable.SetColumnSeparator("|")
paramTable.Render()

if *mistJson {
mistconnector.PrintMistConfigJson(
"livepeer",
Expand Down