Skip to content

Commit

Permalink
Make app runnable without creating default home dir
Browse files Browse the repository at this point in the history
  • Loading branch information
roy-dydx committed Feb 9, 2024
1 parent 6249e97 commit fa247f0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions protocol/cmd/dydxprotocold/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ func NewRootCmdWithInterceptors(
if err != nil {
panic(err)
}
initClientCtx.HomeDir = ""
if err := autoCliOpts(tempApp, initClientCtx).EnhanceRootCommand(rootCmd); err != nil {
panic(err)
}
Expand Down
12 changes: 11 additions & 1 deletion protocol/cmd/dydxprotocold/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func main() {
config.SetupConfig()

option := cmd.GetOptionWithCustomStartCmd()
rootCmd := cmd.NewRootCmd(option, app.DefaultNodeHome)
rootCmd := cmd.NewRootCmd(option, tempDir())

cmd.AddTendermintSubcommands(rootCmd)
cmd.AddInitCmdPostRunE(rootCmd)
Expand All @@ -23,3 +23,13 @@ func main() {
os.Exit(1)
}
}

var tempDir = func() string {
dir, err := os.MkdirTemp("", "dydxprotocol")
if err != nil {
dir = app.DefaultNodeHome
}
defer os.RemoveAll(dir)

return dir
}
3 changes: 2 additions & 1 deletion protocol/testing/containertest/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package containertest
import (
"context"
"fmt"
"github.com/dydxprotocol/v4-chain/protocol/app"
"time"

"github.com/dydxprotocol/v4-chain/protocol/app"

comethttp "github.com/cometbft/cometbft/rpc/client/http"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/config"
Expand Down

0 comments on commit fa247f0

Please sign in to comment.