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
Changes from 1 commit
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
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).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