Skip to content

Commit

Permalink
Merge pull request #433 from armosec/customerstatefeatures
Browse files Browse the repository at this point in the history
Add feature flags support to CustomerState struct
  • Loading branch information
kooomix authored Jan 27, 2025
2 parents 93687f6 + 0b75b39 commit c21d06b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions armotypes/portaltypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,27 @@ type CustomerState struct {
GettingStarted *GettingStartedChecklist `json:"gettingStarted,omitempty" bson:"gettingStarted,omitempty"`
NodeUsage *NodeUsage `json:"nodeUsage,omitempty" bson:"nodeUsage,omitempty"`
AttackChainsLastScan string `json:"attackChainsLastScan,omitempty" bson:"attackChainsLastScan,omitempty"`
FeatureFlags *map[string]bool `json:"enabledFeatureFlags,omitempty" bson:"enabledFeatureFlags,omitempty"`
}

func (cs *CustomerState) IsFeatureEnabled(key string) bool {
if cs.FeatureFlags == nil {
return false
}

if val, ok := (*cs.FeatureFlags)[key]; ok {
return val
}

return false
}

func (cs *CustomerState) SetFeatureEnabled(key string, val bool) {
if cs.FeatureFlags == nil {
cs.FeatureFlags = &map[string]bool{}
}

(*cs.FeatureFlags)[key] = val
}

type User struct {
Expand Down

0 comments on commit c21d06b

Please sign in to comment.