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

Fix skywire-cli config gen -r #1591

Merged
merged 4 commits into from
May 29, 2023
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

updates may be generated with `scripts/changelog.sh <PR#lowest> <PR#highest>`

## 1.3.9

- Fix `skywire-cli config gen -r`

## 1.3.8

- Rebuild Hypervisor UI [#1583](https://github.com/skycoin/skywire/pull/1583)
- Rebuild Hypervisor UI [#1583](https://github.com/skycoin/skywire/pull/1583)
- Change Logserver to use c.JSON method ; remove variable for endpoint name '/node-info' [#1582](https://github.com/skycoin/skywire/pull/1582)
- update changelog [#1580](https://github.com/skycoin/skywire/pull/1580)
Expand Down
33 changes: 16 additions & 17 deletions cmd/skywire-cli/commands/config/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,26 +332,25 @@ var genConfigCmd = &cobra.Command{
oldConfJSON, err := os.ReadFile(confPath)
if err != nil {
if !isStdout || isStdout && isHide {
log.Fatalf("Failed to read config file: %v", err)
log.Errorf("Failed to read config file: %v", err)
}
}
// Decode JSON data
err = json.Unmarshal(oldConfJSON, &oldConf)
if err != nil {
if !isStdout || isStdout && isHide {
log.WithError(err).Fatal("Failed to unmarshal old config json")
}
}
if err != nil {
_, sk = cipher.GenerateKeyPair()
} else {
sk = oldConf.SK
if isRetainHypervisors {
for _, j := range oldConf.Hypervisors {
hypervisorPKs = hypervisorPKs + "," + fmt.Sprintf("\t%s\n", j)
// Decode JSON data
err = json.Unmarshal(oldConfJSON, &oldConf)
if err != nil {
if !isStdout || isStdout && isHide {
log.WithError(err).Fatal("Failed to unmarshal old config json")
}
for _, j := range oldConf.Dmsgpty.Whitelist {
dmsgptyWlPKs = dmsgptyWlPKs + "," + fmt.Sprintf("\t%s\n", j)
_, sk = cipher.GenerateKeyPair()
} else {
sk = oldConf.SK
if isRetainHypervisors {
for _, j := range oldConf.Hypervisors {
hypervisorPKs = hypervisorPKs + "," + fmt.Sprintf("\t%s\n", j)
}
for _, j := range oldConf.Dmsgpty.Whitelist {
dmsgptyWlPKs = dmsgptyWlPKs + "," + fmt.Sprintf("\t%s\n", j)
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/skywire-cli/commands/reward/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func longText() string {
if err != nil {
fmt.Errorf(" reward settings misconfigured!") //nolint
}
_, err = coincipher.DecodeBase58Address(string(reward))
_, err = coincipher.DecodeBase58Address(strings.TrimSpace(string(reward)))
if err != nil {
fmt.Errorf(" invalid address in reward config %v", err) //nolint
}
Expand Down