Skip to content

Commit

Permalink
Use flag names in error messages.
Browse files Browse the repository at this point in the history
This isn't ideal because the flag names are in the `main` package.
  • Loading branch information
NullHypothesis committed Nov 23, 2024
1 parent 52b82d4 commit aa0bd60
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,15 @@ func (c *Config) Validate(_ context.Context) map[string]string {

// Check required fields.
if !isValidPort(c.ExtPort) {
problems["ExtPort"] = "must be a valid port number"
problems["-ext-port"] = "must be a valid port number"
}
if !isValidPort(c.IntPort) {
problems["IntPort"] = "must be a valid port number"
problems["-int-port"] = "must be a valid port number"
}

// Check invalid field combinations.
if c.SilenceApp && c.AppCmd == "" {
problems["SilenceApp"] = "requires -app-cmd to be set"
problems["-silence-app"] = "requires -app-cmd to be set"
}

return problems
Expand Down

0 comments on commit aa0bd60

Please sign in to comment.