Skip to content

Commit

Permalink
fixed bug where already-published-cids flag was not being set
Browse files Browse the repository at this point in the history
added some print lines
  • Loading branch information
FotiosBistas committed Oct 4, 2022
1 parent 5c51fef commit b9c7626
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package config

import (
"encoding/json"
"fmt"
"io/ioutil"
"os"

Expand Down Expand Up @@ -63,7 +64,7 @@ type Config struct {
CidContentSize int `json:"cid-content-size"`
CidNumber int `json:"cid-number"` // in KBs
Workers int `json:"workers"`
AlreadyPublishedCIDs bool `json:"already-published"` //already published CIDs skips the tracking phase of the hoarder.
AlreadyPublishedCIDs bool `json:"already-published-cids"` //already published CIDs skips the publishing phase of the hoarder.
ReqInterval string `json:"req-interval"`
StudyDuration string `json:"study-duration"`
K int `json:"k"`
Expand Down Expand Up @@ -153,8 +154,8 @@ func (c *Config) apply(ctx *cli.Context) {
} else {
c.ReqInterval = DefaultConfig.ReqInterval
}
if ctx.IsSet("already-published") {
c.AlreadyPublishedCIDs = ctx.Bool("already-published")
if ctx.IsSet("already-published-cids") {
c.AlreadyPublishedCIDs = ctx.Bool("already-published-cids")
} else {
c.AlreadyPublishedCIDs = DefaultConfig.AlreadyPublishedCIDs
}
Expand All @@ -178,7 +179,7 @@ func (c *Config) apply(ctx *cli.Context) {
switch c.CidSource {
case RandomSource:
// check the size of the random content to generate
log.Debug("random source for cids found")
fmt.Println("random source for cids found")
if ctx.IsSet("cid-content-size") {
c.CidContentSize = ctx.Int("cid-content-size")
} else {
Expand All @@ -198,14 +199,14 @@ func (c *Config) apply(ctx *cli.Context) {
}
//TODO support different types of cid files
case TextFileSource, JsonFileSource:
log.Debug("text file source or json file source was found")
fmt.Println("text file source or json file source was found")
if ctx.IsSet("cid-file") {
c.CidFile = ctx.String("cid-file")
} else {
c.CidFile = DefaultConfig.CidFile
}
case BitswapSource:
log.Info("bitswap content discovery not supported yet.")
fmt.Println("bitswap content discovery not supported yet.")
os.Exit(0)
default:
log.Info("no cid source was given.")
Expand Down

0 comments on commit b9c7626

Please sign in to comment.