From 0a77f9a78c41f638b881c9238e2aadf784d47f5b Mon Sep 17 00:00:00 2001 From: Gregory Bednov Date: Sat, 12 Jul 2025 13:30:41 +0300 Subject: [PATCH] modified: README.md modified: cli/run.go modified: configfunctions/configfunctions.go modified: go.mod modified: go.sum --- README.md | 10 +++++++--- cli/run.go | 2 +- configfunctions/configfunctions.go | 6 +++--- go.mod | 1 - go.sum | 2 -- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index bd24acb..24b64c2 100644 --- a/README.md +++ b/README.md @@ -16,11 +16,15 @@ The binary exposes several flags. To generate configuration files and keys for a new node run: ```bash -go run . init --mode genesis +go run . init genesis ``` -For joining an existing network use `--mode join` instead. Once configured you -can start the node with: +For joining an existing network use `init join` instead: +```bash +go run . init join +``` + +Once configured you can start the node with: ```bash go run . diff --git a/cli/run.go b/cli/run.go index 7f740a2..6911e46 100644 --- a/cli/run.go +++ b/cli/run.go @@ -158,7 +158,7 @@ func initGenesis() { } db.Close() - cfg.UpdateGenesisJson(node.NodeInfo(), viper) + cfg.UpdateGenesisJson(node.NodeInfo(), viper, filepath.Dir(defaultConfigPath)) fmt.Println("Genesis node initialized.") } diff --git a/configfunctions/configfunctions.go b/configfunctions/configfunctions.go index e51a791..57f643d 100644 --- a/configfunctions/configfunctions.go +++ b/configfunctions/configfunctions.go @@ -166,8 +166,8 @@ func DefaultConfig() *cfg.Config { return cfg.DefaultConfig() } -func UpdateGenesisJson(nodeInfo p2p.NodeInfo, v *viper.Viper) { - file, err := os.ReadFile("./config/genesis.json") // TODO remove hardocded paths +func UpdateGenesisJson(nodeInfo p2p.NodeInfo, v *viper.Viper, defaultConfigDirectoryPath string) { + file, err := os.ReadFile(defaultConfigDirectoryPath + "/genesis.json") if err != nil { panic(err) } @@ -186,7 +186,7 @@ func UpdateGenesisJson(nodeInfo p2p.NodeInfo, v *viper.Viper) { if err != nil { panic(err) } - if err := os.WriteFile("./config/genesis.json", out, 0o644); err != nil { + if err := os.WriteFile(defaultConfigDirectoryPath+"/genesis.json", out, 0o644); err != nil { panic(err) } } diff --git a/go.mod b/go.mod index ed5706e..59f9744 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,6 @@ require ( github.com/spf13/cobra v1.6.0 github.com/spf13/viper v1.13.0 github.com/tendermint/tendermint v0.34.24 - github.com/things-go/go-socks5 v0.0.5 github.com/yggdrasil-network/yggdrasil-go v0.5.12 github.com/yggdrasil-network/yggstack v0.0.0-20250208132654-8ad1962f6456 ) diff --git a/go.sum b/go.sum index 33265ba..abf6e7b 100644 --- a/go.sum +++ b/go.sum @@ -425,8 +425,6 @@ github.com/tendermint/tendermint v0.34.24 h1:879MKKJWYYPJEMMKME+DWUTY4V9f/FBpnZD github.com/tendermint/tendermint v0.34.24/go.mod h1:rXVrl4OYzmIa1I91av3iLv2HS0fGSiucyW9J4aMTpKI= github.com/tendermint/tm-db v0.6.6 h1:EzhaOfR0bdKyATqcd5PNeyeq8r+V4bRPHBfyFdD9kGM= github.com/tendermint/tm-db v0.6.6/go.mod h1:wP8d49A85B7/erz/r4YbKssKw6ylsO/hKtFk7E1aWZI= -github.com/things-go/go-socks5 v0.0.5 h1:qvKaGcBkfDrUL33SchHN93srAmYGzb4CxSM2DPYufe8= -github.com/things-go/go-socks5 v0.0.5/go.mod h1:mtzInf8v5xmsBpHZVbIw2YQYhc4K0jRwzfsH64Uh0IQ= github.com/tinylib/msgp v1.1.5/go.mod h1:eQsjooMTnV42mHu917E26IogZ2930nFyBQdofk10Udg= github.com/ttacon/chalk v0.0.0-20160626202418-22c06c80ed31/go.mod h1:onvgF043R+lC5RZ8IT9rBXDaEDnpnw/Cl+HFiw+v/7Q= github.com/twmb/murmur3 v1.1.6 h1:mqrRot1BRxm+Yct+vavLMou2/iJt0tNVTTC0QoIjaZg=