mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 11:41:19 +00:00
Config flag upgrade (#5491)
* allowing different values other than strings * updated readme * ops * better error msg
This commit is contained in:
parent
fdb83de6f5
commit
511a5373f6
14
README.md
14
README.md
@ -192,36 +192,36 @@ C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin
|
|||||||
You can set Erigon flags through a YAML or TOML configuration file with the flag `--config`. The flags set in the configuration
|
You can set Erigon flags through a YAML or TOML configuration file with the flag `--config`. The flags set in the configuration
|
||||||
file can be overwritten by writing the flags directly on Erigon command line
|
file can be overwritten by writing the flags directly on Erigon command line
|
||||||
|
|
||||||
## Example
|
### Example
|
||||||
|
|
||||||
`./build/bin/erigon --config ./config.yaml --chain=goerli
|
`./build/bin/erigon --config ./config.yaml --chain=goerli
|
||||||
|
|
||||||
Assuming we have `chain : "mainnet" in our configuration file, by adding `--chain=goerli` allows the overwrite of the flag inside
|
Assuming we have `chain : "mainnet" in our configuration file, by adding `--chain=goerli` allows the overwrite of the flag inside
|
||||||
of the yaml configuration file and sets the chain to goerli
|
of the yaml configuration file and sets the chain to goerli
|
||||||
|
|
||||||
## TOML
|
### TOML
|
||||||
|
|
||||||
Example of setting up TOML config file
|
Example of setting up TOML config file
|
||||||
|
|
||||||
```
|
```
|
||||||
`datadir = 'your datadir'
|
`datadir = 'your datadir'
|
||||||
port = "1111"
|
port = 1111
|
||||||
chain = "mainnet"
|
chain = "mainnet"
|
||||||
http = "true"
|
http = true
|
||||||
"private.api.addr"="localhost:9090"
|
"private.api.addr"="localhost:9090"
|
||||||
|
|
||||||
"http.api" = ["eth","debug","net"]
|
"http.api" = ["eth","debug","net"]
|
||||||
```
|
```
|
||||||
|
|
||||||
## YAML
|
### YAML
|
||||||
|
|
||||||
Example of setting up a YAML config file
|
Example of setting up a YAML config file
|
||||||
|
|
||||||
```
|
```
|
||||||
datadir : 'your datadir'
|
datadir : 'your datadir'
|
||||||
port : "1111"
|
port : 1111
|
||||||
chain : "mainnet"
|
chain : "mainnet"
|
||||||
http : "true"
|
http : true
|
||||||
private.api.addr : "localhost:9090"
|
private.api.addr : "localhost:9090"
|
||||||
|
|
||||||
http.api : ["eth","debug","net"]
|
http.api : ["eth","debug","net"]
|
||||||
|
@ -101,16 +101,17 @@ func setFlagsFromConfigFile(ctx *cli.Context, filePath string) error {
|
|||||||
sliceInterface := value.([]interface{})
|
sliceInterface := value.([]interface{})
|
||||||
s := make([]string, len(sliceInterface))
|
s := make([]string, len(sliceInterface))
|
||||||
for i, v := range sliceInterface {
|
for i, v := range sliceInterface {
|
||||||
s[i] = v.(string)
|
s[i] = fmt.Sprintf("%v", v)
|
||||||
}
|
}
|
||||||
err := ctx.GlobalSet(key, strings.Join(s, ","))
|
err := ctx.GlobalSet(key, strings.Join(s, ","))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("failed setting %s flag with values=%s error=%s", key, s, err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
err := ctx.GlobalSet(key, value.(string))
|
err := ctx.GlobalSet(key, fmt.Sprintf("%v", value))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("failed setting %s flag with value=%v error=%s", key, value, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user