Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

Commit

Permalink
Create cosmos client home if it doesnt exist
Browse files Browse the repository at this point in the history
  • Loading branch information
xmariachi committed Feb 8, 2024
1 parent bc98999 commit 153c2fa
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions cmd/node/appchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,16 @@ func NewAppChain(config AppChainConfig, log zerolog.Logger) (*AppChain, error) {
cosmosClientHome = config.CosmosHomeDir
}

// Check that the given home folder is exist
// Check that the given home folder exist
if _, err := os.Stat(cosmosClientHome); errors.Is(err, os.ErrNotExist) {
log.Warn().Err(err).Msg("could not get home directory for cosmos client")
config.SubmitTx = false
return nil, err
log.Warn().Err(err).Msg("could not get home directory for cosmos client, creating...")
err = os.MkdirAll(cosmosClientHome, 0755)
if err != nil {
log.Warn().Err(err).Str("directory", cosmosClientHome).Msg("Cannot create cosmos client home directory")
config.SubmitTx = false
return nil, err
}
log.Info().Err(err).Str("directory", cosmosClientHome).Msg("cosmos client home directory created")
}

// create a cosmos client instance
Expand Down

0 comments on commit 153c2fa

Please sign in to comment.