Skip to content

Commit

Permalink
Issue license for community and enterprise edition with kubedb-ent (#11)
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha authored Sep 16, 2020
1 parent 67d8755 commit 13d804a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
14 changes: 6 additions & 8 deletions pkg/server/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ package server

import (
"time"

"github.com/appscode/go/sets"
)

const (
Expand All @@ -35,9 +33,9 @@ const (
LicenseBucket = "appscode-licenses"
)

var supportedProducts = sets.NewString(
"kubedb-community",
"kubedb-enterprise",
"stash-community",
"stash-enterprise",
)
var supportedProducts = map[string][]string{
"kubedb-community": {"kubedb-community"},
"kubedb-enterprise": {"kubedb-enterprise", "kubedb-community"},
"stash-community": {"stash-community"},
"stash-enterprise": {"stash-enterprise"},
}
2 changes: 1 addition & 1 deletion pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ func (s *Server) CreateLicense(license ProductLicense, cluster string) ([]byte,
}
cfg := Config{
CommonName: getCN(sans),
Organization: []string{license.Product},
Organization: supportedProducts[license.Product],
AltNames: sans,
Usages: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth},
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/server/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (form LicenseForm) Validate() error {
if err != nil {
return err
}
if !supportedProducts.Has(form.Product) {
if _, found := supportedProducts[form.Product]; !found {
return fmt.Errorf("unknown product: %s", form.Product)
}
if agree, _ := strconv.ParseBool(form.Tos); !agree {
Expand Down

0 comments on commit 13d804a

Please sign in to comment.