ethutil: remove Config variable

Various functions throughout the codebase used it to grab settings. This
has to stop because I want to use them without reading the config file.

These functions can now be used without reading the config first:

* ethdb.NewLDBDatabase
* ethrepl.NewJSRepl
* vm.New
This commit is contained in:
Felix Lange
2015-03-06 02:46:56 +01:00
parent c47866d251
commit bdba044a80
7 changed files with 29 additions and 37 deletions

View File

@ -1,11 +1,10 @@
package ethdb
import (
"path"
"fmt"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/compression/rle"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/syndtr/goleveldb/leveldb"
"github.com/syndtr/goleveldb/leveldb/iterator"
)
@ -15,17 +14,13 @@ type LDBDatabase struct {
comp bool
}
func NewLDBDatabase(name string) (*LDBDatabase, error) {
dbPath := path.Join(ethutil.Config.ExecPath, name)
func NewLDBDatabase(file string) (*LDBDatabase, error) {
// Open the db
db, err := leveldb.OpenFile(dbPath, nil)
db, err := leveldb.OpenFile(file, nil)
if err != nil {
return nil, err
}
database := &LDBDatabase{db: db, comp: true}
return database, nil
}