Skip to content

Commit

Permalink
refactor: config checker
Browse files Browse the repository at this point in the history
one rule was broken due to new semantics of confDepth flag, which can't be negative anymore
  • Loading branch information
samlaf committed Sep 20, 2024
1 parent 3ccbc25 commit 3e6f648
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions server/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,16 +246,20 @@ func (cfg *Config) Check() error {
return fmt.Errorf("max blob length is 0")
}

if cfg.SvcManagerAddr != "" && cfg.EthRPC == "" {
return fmt.Errorf("svc manager address is set, but Eth RPC is not set")
}
// memstore not enabled means we use eigenda as a backend, which requires these fields to be set
if !cfg.MemstoreEnabled {
if cfg.ClientConfig.RPC == "" {
return fmt.Errorf("eigenda disperser rpc url is not set")
}

if cfg.EthRPC != "" && cfg.SvcManagerAddr == "" {
return fmt.Errorf("eth rpc is set, but svc manager address is not set")
}
if cfg.EthRPC == "" {
return fmt.Errorf("eth rpc is not set")
}

if cfg.SvcManagerAddr == "" {
return fmt.Errorf("svc manager address is not set")
}

if cfg.EthConfirmationDepth >= 0 && (cfg.SvcManagerAddr == "" || cfg.EthRPC == "") {
return fmt.Errorf("eth confirmation depth is set for certificate verification, but Eth RPC or SvcManagerAddr is not set")
}

Check failure on line 263 in server/config.go

View workflow job for this annotation

GitHub Actions / Linter

unnecessary trailing newline (whitespace)

if cfg.S3Config.S3CredentialType == store.S3CredentialUnknown && cfg.S3Config.Endpoint != "" {
Expand All @@ -271,10 +275,6 @@ func (cfg *Config) Check() error {
return fmt.Errorf("redis password is set, but endpoint is not")
}

if !cfg.MemstoreEnabled && cfg.ClientConfig.RPC == "" {
return fmt.Errorf("eigenda disperser rpc url is not set")
}

err = cfg.checkTargets(cfg.FallbackTargets)
if err != nil {
return err
Expand Down

0 comments on commit 3e6f648

Please sign in to comment.