feat: parse home flag earlier (#20771)

This commit is contained in:
Julien Robert
2024-06-25 18:53:57 +00:00
committed by GitHub
parent 524a84c3ba
commit 5aaff21096
22 changed files with 87 additions and 99 deletions
-3
View File
@@ -9,9 +9,6 @@ const (
)
const (
FlagHome = "home"
FlagKeyringDir = "keyring-dir"
FlagUseLedger = "ledger"
FlagChainID = "chain-id"
FlagNode = "node"
FlagGRPC = "grpc-addr"
+2 -1
View File
@@ -109,7 +109,8 @@ func AddCommands(rootCmd *cobra.Command, newApp AppCreator[transaction.Tx], logg
// configHandle writes the default config to the home directory if it does not exist and sets the server context
func configHandle(s *Server, home string, cmd *cobra.Command) error {
if _, err := os.Stat(filepath.Join(home, "config")); os.IsNotExist(err) {
// we need to check app.toml as the config folder can already exist for the client.toml
if _, err := os.Stat(filepath.Join(home, "config", "app.toml")); os.IsNotExist(err) {
if err = s.WriteConfig(filepath.Join(home, "config")); err != nil {
return err
}