Skip to content

Commit

Permalink
Relax the condition for parsing AddrFlag (#1327)
Browse files Browse the repository at this point in the history
With the existing check it's impossible to pass anything that is not resolved to an IP Address. In particular, it fails to run locally inside Docker container and parse 'host.docker.internal'.
  • Loading branch information
leszko authored Jul 19, 2024
1 parent 3f48270 commit 49da1cb
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions config/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,10 @@ func (cli *Cli) ParseLegacyEnv() {
func AddrFlag(fs *flag.FlagSet, dest *string, name, value, usage string) {
*dest = value
fs.Func(name, usage, func(s string) error {
host, _, err := net.SplitHostPort(s)
_, _, err := net.SplitHostPort(s)
if err != nil {
return err
}
ip := net.ParseIP(host)
if ip == nil {
return fmt.Errorf("invalid address: %s", s)
}
*dest = s
return nil
})
Expand Down

0 comments on commit 49da1cb

Please sign in to comment.