diff options
author | Stephen Buttolph <[email protected]> | 2020-10-30 17:29:21 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2020-10-30 17:29:21 -0400 |
commit | c613e21ea107e8369926f4b53b7830a9d5dabf18 (patch) | |
tree | 7fbd50b5628c6f687d7c5e68886b8f39fa135481 /plugin/params.go | |
parent | 806d04e9aa4b6e22fc2a484ada6fecb0c9a348e3 (diff) | |
parent | a6ffdbbdd269fae35c5600e954bd373b619fe733 (diff) |
Merge pull request #45 from ava-labs/handle-config
Parse config to set enabled APIs
Diffstat (limited to 'plugin/params.go')
-rw-r--r-- | plugin/params.go | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/plugin/params.go b/plugin/params.go index 1810295..6615798 100644 --- a/plugin/params.go +++ b/plugin/params.go @@ -5,37 +5,32 @@ import ( "flag" "os" - "github.com/ava-labs/avalanchego/utils/wrappers" "github.com/ava-labs/coreth/plugin/evm" ) -const ( - name = "coreth" -) - var ( cliConfig evm.CommandLineConfig - errs wrappers.Errs ) func init() { - errs := wrappers.Errs{} - fs := flag.NewFlagSet(name, flag.ContinueOnError) + fs := flag.NewFlagSet("coreth", flag.ContinueOnError) - config := fs.String("coreth-config", "default", "Pass in CLI Config to set runtime attributes for Coreth") + config := fs.String("config", "default", "Pass in CLI Config to set runtime attributes for Coreth") if err := fs.Parse(os.Args[1:]); err != nil { - errs.Add(err) + cliConfig.ParsingError = err return } if *config == "default" { cliConfig.EthAPIEnabled = true + cliConfig.PersonalAPIEnabled = true cliConfig.TxPoolAPIEnabled = true + cliConfig.NetAPIEnabled = true cliConfig.RPCGasCap = 2500000000 // 25000000 x 100 cliConfig.RPCTxFeeCap = 100 // 100 AVAX } else { // TODO only overwrite values that were explicitly set - errs.Add(json.Unmarshal([]byte(*config), &cliConfig)) + cliConfig.ParsingError = json.Unmarshal([]byte(*config), &cliConfig) } } |