Skip to content

Commit

Permalink
fix(): file parse issue resolution
Browse files Browse the repository at this point in the history
Signed-off-by: Puran Adhikari <[email protected]>
  • Loading branch information
PuranAdhikari authored Mar 31, 2023
1 parent 4464c75 commit 4c37b75
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions pkg/events/events_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,15 @@ func GetEvent(name EventName) (*EventSchema, error) {
}

func IsEventDisabled(name EventName) bool {
controllerFilePath := "/events/event-schema/controller.yaml"
workerFilePath := "/events/event-schema/worker.yaml"
controllerConfigs, err := parseConfig(controllerFilePath)
if err != nil {
return false
}
workerConfigs, err := parseConfig(workerFilePath)
return isDisabledInFile(name, "/events/event-schema/controller.yaml") ||
isDisabledInFile(name, "/events/event-schema/worker.yaml")
}

func isDisabledInFile(name EventName, filepath string) bool {
configs, err := parseConfig(filepath)
if err != nil {
return false
}
configs := append(controllerConfigs, workerConfigs...)
for _, config := range configs {
if config == string(name) {
return true
Expand Down

0 comments on commit 4c37b75

Please sign in to comment.