change explorer node storage folder (#2720)

pull/2727/head
Minh Doan 5 years ago committed by GitHub
parent 3aa08e9e3b
commit 1f83ebf6a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      api/service/explorer/storage.go
  2. 2
      api/service/explorer/storage_test.go
  3. 1
      cmd/harmony/main.go

@ -7,6 +7,7 @@ import (
"github.com/ethereum/go-ethereum/rlp"
"github.com/harmony-one/harmony/core/types"
nodeconfig "github.com/harmony-one/harmony/internal/configs/node"
"github.com/harmony-one/harmony/internal/utils"
staking "github.com/harmony-one/harmony/staking/types"
"github.com/syndtr/goleveldb/leveldb"
@ -46,7 +47,7 @@ func GetStorageInstance(ip, port string, remove bool) *Storage {
// Init initializes the block update.
func (storage *Storage) Init(ip, port string, remove bool) {
dbFileName := "/tmp/explorer_storage_" + ip + "_" + port
dbFileName := nodeconfig.GetDefaultConfig().DBDir + "/explorer_storage_" + ip + "_" + port
var err error
if remove {
var err = os.RemoveAll(dbFileName)

@ -4,6 +4,7 @@ import (
"bytes"
"testing"
nodeconfig "github.com/harmony-one/harmony/internal/configs/node"
"github.com/stretchr/testify/assert"
)
@ -14,6 +15,7 @@ func TestGetAddressKey(t *testing.T) {
// TestInit ..
func TestInit(t *testing.T) {
nodeconfig.GetDefaultConfig().DBDir = "/tmp"
ins := GetStorageInstance("1.1.1.1", "3333", true)
if err := ins.GetDB().Put([]byte{1}, []byte{2}, nil); err != nil {
t.Fatal("(*LDBDatabase).Put failed:", err)

@ -523,6 +523,7 @@ func setupConsensusAndNode(nodeConfig *nodeconfig.ConfigType) *node.Node {
nodeconfig.NewGroupIDByShardID(shard.BeaconChainShardID),
)
nodeconfig.GetDefaultConfig().DBDir = nodeConfig.DBDir
switch *nodeType {
case "explorer":
nodeconfig.SetDefaultRole(nodeconfig.ExplorerNode)

Loading…
Cancel
Save