Skip to content

Commit

Permalink
fixed spec verification to accept extra profiles (#441)
Browse files Browse the repository at this point in the history
* fixed spec verification to pass if more profiles are running

* Merge branch 'master' into milad/fix-spec-extra-profile

* removed unused function

* Merge branch 'master' into milad/fix-spec-extra-profile
  • Loading branch information
miladz68 authored Nov 22, 2024
1 parent aee1cf8 commit 081f5e3
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions infra/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ func (s *Spec) Verify() error {
if s.Env != s.configF.EnvName {
return errors.Errorf("env mismatch, spec: %s, config: %s", s.Env, s.configF.EnvName)
}
if !profilesCompare(s.Profiles, s.configF.Profiles) {
if !lo.Every(s.Profiles, s.configF.Profiles) {
return errors.Errorf(
"profile mismatch, spec: %s, config: %s",
strings.Join(s.Profiles, ","),
Expand Down Expand Up @@ -575,20 +575,3 @@ func (ai *AppInfo) UnmarshalJSON(data []byte) error {

return json.Unmarshal(data, &ai.data)
}

func profilesCompare(p1, p2 []string) bool {
if len(p1) != len(p2) {
return false
}

profiles := map[string]bool{}
for _, p := range p1 {
profiles[p] = true
}
for _, p := range p2 {
if !profiles[p] {
return false
}
}
return true
}

0 comments on commit 081f5e3

Please sign in to comment.