File tree Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -50,9 +50,13 @@ func (c InletsProConfig) GetLicenseKey() (string, error) {
5050 return "" , fmt .Errorf ("--license or --license-key is required for inlets PRO" )
5151 }
5252
53- if total := strings .Count (val , "." ); total >= 2 {
53+ if dots := strings .Count (val , "." ); dots >= 2 {
5454 return strings .TrimSpace (val ), nil
5555 }
5656
57- return "" , fmt .Errorf ("inlets PRO license may be invalid" )
57+ if dashes := strings .Count (val , "-" ); dashes == 3 {
58+ return strings .TrimSpace (val ), nil
59+ }
60+
61+ return "" , fmt .Errorf ("inlets license may be invalid" )
5862}
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ func Test_GetLicenseKey_FromFile(t *testing.T) {
5353 }
5454}
5555
56- func Test_GetLicenseKey_FromFileTrimsWhitespace (t * testing.T ) {
56+ func Test_GetLicenseKey_FromFileTrimsWhitespace_JWT (t * testing.T ) {
5757 want := `static.key.text`
5858
5959 tmp := os .TempDir ()
@@ -84,3 +84,20 @@ func Test_GetLicenseKey_FromFileTrimsWhitespace(t *testing.T) {
8484 t .Fatalf ("want %q but got %q" , want , key )
8585 }
8686}
87+
88+ func Test_GetLicenseKey_FromLiteral_WithDashes (t * testing.T ) {
89+ want := `static-dashes-key-text`
90+
91+ c := InletsProConfig {
92+ License : want ,
93+ }
94+
95+ key , err := c .GetLicenseKey ()
96+ if err != nil {
97+ t .Fatalf ("no error wanted for a valid key" )
98+ }
99+
100+ if want != key {
101+ t .Fatalf ("want %q but got %q" , want , key )
102+ }
103+ }
You can’t perform that action at this time.
0 commit comments