Skip to content

Commit

Permalink
Set port automatically when creating monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
bitfield committed Aug 12, 2019
1 parent 8b6813e commit 6483efa
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package cmd
import (
"fmt"
"log"
"strings"

"github.com/bitfield/uptimerobot/pkg"
uptimerobot "github.com/bitfield/uptimerobot/pkg"
"github.com/spf13/cobra"
)

Expand All @@ -19,6 +20,10 @@ var newCmd = &cobra.Command{
FriendlyName: args[1],
Type: uptimerobot.MonitorType("HTTP"),
AlertContacts: contacts,
Port: 80,
}
if strings.HasPrefix(m.URL, "https") {
m.Port = 443
}
new, err := client.NewMonitor(m)
if err != nil {
Expand Down

0 comments on commit 6483efa

Please sign in to comment.