Skip to content

Commit

Permalink
make path to degendata repo configurable, read jsons after initializi…
Browse files Browse the repository at this point in the history
…ng other stuff
  • Loading branch information
benleb committed Jun 16, 2023
1 parent bcbc72d commit 722ba14
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
22 changes: 12 additions & 10 deletions cmd/live.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,6 @@ func runGloomberg(_ *cobra.Command, _ []string) {
gb.Pr(fmt.Sprintf("connected to %s providers: %s", style.AlmostWhiteStyle.Render(fmt.Sprint(len(providers))), style.AlmostWhiteStyle.Render(strings.Join(nodeNames, ", "))))
}

//
// degendata - ranks
go func() {
if err := degendata.LoadOpenseaRanks(gb); err != nil {
gbl.Log.Errorf("error loading opensea ranks: %v", err)
}
}()

//
// queue for everything to print to the console
terminalPrinterQueue := make(chan string, 256)
Expand Down Expand Up @@ -418,6 +410,14 @@ func runGloomberg(_ *cobra.Command, _ []string) {
}()
}

//
// degendata - ranks
go func() {
if err := degendata.LoadOpenseaRanks(gb); err != nil {
gbl.Log.Errorf("error loading opensea ranks: %v", err)
}
}()

//
// web ui
if viper.GetBool("web.enabled") {
Expand Down Expand Up @@ -447,6 +447,8 @@ func runGloomberg(_ *cobra.Command, _ []string) {
select {}
}

var degendataPath string

func init() { //nolint:gochecknoinits
rootCmd.AddCommand(liveCmd)

Expand Down Expand Up @@ -512,8 +514,8 @@ func init() { //nolint:gochecknoinits
_ = viper.BindPFlag("show.unknown", liveCmd.Flags().Lookup("show-unknown"))

// degendb
// liveCmd.Flags().StringVar(&ddbPath, "dd-path", "degendata", "path to degendata dir")
viper.SetDefault("degendata.path", "degendata")
liveCmd.Flags().StringVar(&degendataPath, "degendata", "degendata", "path to degendata repo")
_ = viper.BindPFlag("degendata.path", liveCmd.Flags().Lookup("degendata"))

// worker settings
viper.SetDefault("trapri.numOpenSeaEventhandlers", 3)
Expand Down
2 changes: 1 addition & 1 deletion degendata
1 change: 1 addition & 0 deletions internal/degendb/degendata/degendata.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (

func LoadOpenseaRanks(gb *gloomberg.Gloomberg) error {
ddPathRanks := path.Join(viper.GetString("degendata.path"), "ranks")
log.Debugf("loading opensea ranks from %s", ddPathRanks)

ranksFiles, err := os.ReadDir(ddPathRanks)
if err != nil {
Expand Down

0 comments on commit 722ba14

Please sign in to comment.