Commit 626f998c authored by Sabnock01's avatar Sabnock01

fix: challenger-tests

parent 2abbf422
...@@ -5,6 +5,7 @@ import ( ...@@ -5,6 +5,7 @@ import (
"math" "math"
opservice "github.com/ethereum-optimism/optimism/op-service" opservice "github.com/ethereum-optimism/optimism/op-service"
"github.com/ethereum-optimism/optimism/op-service/cliapp"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
) )
...@@ -25,19 +26,9 @@ func DefaultCLIConfig() CLIConfig { ...@@ -25,19 +26,9 @@ func DefaultCLIConfig() CLIConfig {
} }
} }
type FlagValue string
func (fv FlagValue) Set(value string) error {
*(*string)(&fv) = value
return nil
}
func (fv FlagValue) String() string {
return string(fv)
}
func CLIFlags(envPrefix string) []cli.Flag { func CLIFlags(envPrefix string) []cli.Flag {
return []cli.Flag{ return []cli.Flag{
&cli.GenericFlag{ &cli.BoolFlag{
Name: EnabledFlagName, Name: EnabledFlagName,
Usage: "Enable the metrics server", Usage: "Enable the metrics server",
EnvVars: opservice.PrefixEnvVar(envPrefix, "METRICS_ENABLED"), EnvVars: opservice.PrefixEnvVar(envPrefix, "METRICS_ENABLED"),
...@@ -45,18 +36,40 @@ func CLIFlags(envPrefix string) []cli.Flag { ...@@ -45,18 +36,40 @@ func CLIFlags(envPrefix string) []cli.Flag {
&cli.GenericFlag{ &cli.GenericFlag{
Name: ListenAddrFlagName, Name: ListenAddrFlagName,
Usage: "Metrics listening address", Usage: "Metrics listening address",
Value: FlagValue(defaultListenAddr), // TODO(CLI-4159): Switch to 127.0.0.1 Value: NewFlagValue(defaultListenAddr), // TODO(CLI-4159): Switch to 127.0.0.1
EnvVars: opservice.PrefixEnvVar(envPrefix, "METRICS_ADDR"), EnvVars: opservice.PrefixEnvVar(envPrefix, "METRICS_ADDR"),
}, },
&cli.GenericFlag{ &cli.GenericFlag{
Name: PortFlagName, Name: PortFlagName,
Usage: "Metrics listening port", Usage: "Metrics listening port",
Value: FlagValue(defaultListenAddr), Value: NewFlagValue(defaultListenAddr),
EnvVars: opservice.PrefixEnvVar(envPrefix, "METRICS_PORT"), EnvVars: opservice.PrefixEnvVar(envPrefix, "METRICS_PORT"),
}, },
} }
} }
type FlagValue string
func NewFlagValue(s string) *FlagValue {
return (*FlagValue)(&s)
}
func (fv *FlagValue) Set(value string) error {
*(*string)(fv) = value
return nil
}
func (fv FlagValue) String() string {
return string(fv)
}
func (fv *FlagValue) Clone() any {
cpy := *fv
return &cpy
}
var _ cliapp.CloneableGeneric = (*FlagValue)(nil)
type CLIConfig struct { type CLIConfig struct {
Enabled bool Enabled bool
ListenAddr string ListenAddr string
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment