sfcs/flags/parseRole.go

19 lines
379 B
Go
Raw Normal View History

2025-01-29 23:20:44 +01:00
package flags
import "fmt"
func (flags *Flags) parseRole() (err error) {
// Ensure that role field is not empty
if flags.Vars.Role == "" {
return fmt.Errorf("Role cannot be empty")
}
// Ensure that role field is valid
if flags.Vars.Role != "scheduler" && flags.Vars.Role != "agent" {
return fmt.Errorf("Role must be either 'scheduler' or 'agent'")
}
return nil
}