Update readme to run server

This commit is contained in:
nabarun 2022-05-09 13:01:34 +05:30
parent 864e124ebc
commit b55cc1989c
4 changed files with 34 additions and 0 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
.idea/ .idea/
leveldb-ethdb-rpc leveldb-ethdb-rpc
environments/config.toml

4
Makefile Normal file
View File

@ -0,0 +1,4 @@
# Build
build:
go fmt ./...
go build

View File

@ -1,2 +1,26 @@
# leveldb-ethdb-rpc # leveldb-ethdb-rpc
Thin RPC wrapper around LevelDB to expose data remotely Thin RPC wrapper around LevelDB to expose data remotely
## Setup
Run the following
```bash
make build
```
Create a `config.toml` file from [example.toml](./environments/example.toml) file.
Update the config for path to geth leveldb and geth ancient database
```toml
[leveldb]
path = "/path/to/eth/data/geth/chaindata" # $LEVELDB_PATH
ancient = "/path/to/eth/data/geth/chaindata/ancient" # $LEVELDB_ANCIENT_PATH
```
## Usage
After building the binary, run as
`./leveldb-ethdb-rpc serve --config ./environments/config.toml`

View File

@ -79,6 +79,11 @@ func logLevel() error {
return nil return nil
} }
func init() {
cobra.OnInitialize(initConfig)
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file location")
}
// initConfig reads in config file and ENV variables if set. // initConfig reads in config file and ENV variables if set.
func initConfig() { func initConfig() {
if cfgFile != "" { if cfgFile != "" {