Skip to content

Commit 92222d6

Browse files
authored
Fix dev endpoint check (#5464)
1 parent b23316d commit 92222d6

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

pkg/metrics/install.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"bytes"
55
"encoding/json"
66
"fmt"
7-
"regexp"
7+
"strings"
88
"time"
99

1010
"github.com/pkg/errors"
@@ -113,6 +113,5 @@ func getEndpoint(license *kotsv1beta1.License) (string, error) {
113113
}
114114

115115
func isDevEndpoint(endpoint string) bool {
116-
result, _ := regexp.MatchString(`replicated-app`, endpoint)
117-
return result
116+
return strings.HasPrefix(endpoint, "http://replicated-app:")
118117
}

pkg/reporting/util.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package reporting
33
import (
44
"net/http"
55
"os"
6-
"regexp"
76
"strconv"
7+
"strings"
88

99
"github.com/replicatedhq/kots/pkg/api/reporting/types"
1010
)
@@ -98,6 +98,5 @@ func canReport(endpoint string) bool {
9898
}
9999

100100
func isDevEndpoint(endpoint string) bool {
101-
result, _ := regexp.MatchString(`replicated-app`, endpoint)
102-
return result
101+
return strings.HasPrefix(endpoint, "http://replicated-app:")
103102
}

0 commit comments

Comments
 (0)