Skip to content

Commit

Permalink
fix: require cert-file and key-file options
Browse files Browse the repository at this point in the history
cert-file is used to derive certain required identifiers within the MQTT and HTTP clients. This effectively makes the cert-file a required field, but we have to manually check for their non-empty values because of limitations in the cli package. See urfave/cli#849.

Fixes RHCLOUD-12333

Signed-off-by: Link Dupont <link@sub-pop.net>
  • Loading branch information
subpop committed Apr 8, 2021
1 parent 9280ddf commit c15c133
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cmd/yggd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ func main() {
if err != nil {
return err
}
return altsrc.ApplyInputSourceValues(c, inputSource, app.Flags)
if err := altsrc.ApplyInputSourceValues(c, inputSource, app.Flags); err != nil {
return err
}
}
return nil
}
Expand All @@ -106,6 +108,12 @@ func main() {
return nil
}

for _, f := range []string{"cert-file", "key-file"} {
if c.String(f) == "" {
return cli.Exit(fmt.Errorf("required flag '%v' not set", f), 1)
}
}

if c.String("topic-prefix") != "" {
yggdrasil.TopicPrefix = c.String("topic-prefix")
}
Expand Down

0 comments on commit c15c133

Please sign in to comment.