mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 03:30:37 +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
|
||||
file can be overwritten by writing the flags directly on Erigon command line
|
||||
|
||||
## Example
|
||||
### Example
|
||||
|
||||
`./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
|
||||
of the yaml configuration file and sets the chain to goerli
|
||||
|
||||
## TOML
|
||||
### TOML
|
||||
|
||||
Example of setting up TOML config file
|
||||
|
||||
```
|
||||
`datadir = 'your datadir'
|
||||
port = "1111"
|
||||
port = 1111
|
||||
chain = "mainnet"
|
||||
http = "true"
|
||||
http = true
|
||||
"private.api.addr"="localhost:9090"
|
||||
|
||||
"http.api" = ["eth","debug","net"]
|
||||
```
|
||||
|
||||
## YAML
|
||||
### YAML
|
||||
|
||||
Example of setting up a YAML config file
|
||||
|
||||
```
|
||||
datadir : 'your datadir'
|
||||
port : "1111"
|
||||
port : 1111
|
||||
chain : "mainnet"
|
||||
http : "true"
|
||||
http : true
|
||||
private.api.addr : "localhost:9090"
|
||||
|
||||
http.api : ["eth","debug","net"]
|
||||
|
@ -101,16 +101,17 @@ func setFlagsFromConfigFile(ctx *cli.Context, filePath string) error {
|
||||
sliceInterface := value.([]interface{})
|
||||
s := make([]string, len(sliceInterface))
|
||||
for i, v := range sliceInterface {
|
||||
s[i] = v.(string)
|
||||
s[i] = fmt.Sprintf("%v", v)
|
||||
}
|
||||
err := ctx.GlobalSet(key, strings.Join(s, ","))
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("failed setting %s flag with values=%s error=%s", key, s, err)
|
||||
}
|
||||
} else {
|
||||
err := ctx.GlobalSet(key, value.(string))
|
||||
err := ctx.GlobalSet(key, fmt.Sprintf("%v", value))
|
||||
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