prysm-pulse/cmd/beacon-chain/flags/api_module.go
Radosław Kapka 12480e12b2
Add flags for disabling selected API (#9606)
* Add flags for disabling selected API

* tests

* build file

* Use comma-separated modules

* test fix

* fix gateway tests

* fix import in flag tests
2021-09-24 09:25:42 +00:00

24 lines
482 B
Go

package flags
import "strings"
const PrysmAPIModule string = "prysm"
const EthAPIModule string = "eth"
func EnableHTTPPrysmAPI(httpModules string) bool {
return enableAPI(httpModules, PrysmAPIModule)
}
func EnableHTTPEthAPI(httpModules string) bool {
return enableAPI(httpModules, EthAPIModule)
}
func enableAPI(httpModules string, api string) bool {
for _, m := range strings.Split(httpModules, ",") {
if strings.EqualFold(m, api) {
return true
}
}
return false
}