Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Commit

Permalink
cmd/server: use viper to get flag values
Browse files Browse the repository at this point in the history
  • Loading branch information
ggarnier authored and nettoclaudio committed Aug 2, 2018
1 parent 2a05bf4 commit 259da3a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions cmd/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,11 @@ func New() *cobra.Command {
PreRun: serverCommandPreRun,
Run: serverCommandRun,
Args: func(cmd *cobra.Command, args []string) error {
flags := cmd.Flags()
if !flags.Lookup("insecure").Changed {
if !flags.Lookup("cert-file").Changed {
if !viper.GetBool("server.insecure") {
if len(viper.GetString("server.cert-file")) == 0 {
return errors.New("cert-file is required")
}
if !flags.Lookup("key-file").Changed {
if len(viper.GetString("server.key-file")) == 0 {
return errors.New("key-file is required")
}
}
Expand Down

0 comments on commit 259da3a

Please sign in to comment.