main.go 653 B

123456789101112131415161718192021222324252627282930313233343536
  1. package main
  2. import (
  3. "fmt"
  4. "os"
  5. "gitea.ligthert.net/golang/sfcs/flags"
  6. "gitea.ligthert.net/golang/sfcs/server"
  7. "gitea.ligthert.net/golang/sfcs/vars"
  8. )
  9. func main() {
  10. // Create a new instance of the Controller struct
  11. vars := vars.Vars{}
  12. // Create a new instance of the Flags struct
  13. flags := flags.Flags{Vars: &vars}
  14. err := flags.ParseFlags()
  15. if err != nil {
  16. fmt.Println(err)
  17. os.Exit(1)
  18. }
  19. // Switch on the role
  20. switch vars.Role {
  21. case "scheduler":
  22. server := server.Server{ListenAddress: vars.Address, ListenPort: vars.Port}
  23. vars.Operator = &server
  24. case "agent":
  25. // operator := client.Client{}
  26. }
  27. vars.Operator.Start()
  28. }