main.go 709 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package main
  2. import (
  3. "flag"
  4. "fmt"
  5. "os"
  6. "git.linuxforward.com/byom/byom-gateway/app"
  7. "git.linuxforward.com/byom/byom-gateway/config"
  8. )
  9. func main() {
  10. cfgPath := flag.String("config", "config.yaml", "Path to the configuration file")
  11. flag.Parse()
  12. if *cfgPath == "" {
  13. fmt.Println("Config file not provided")
  14. os.Exit(1)
  15. }
  16. // Read the configuration file
  17. cfg, err := config.ReadConfig(*cfgPath)
  18. if err != nil {
  19. fmt.Println("Error reading the configuration file: ", err)
  20. os.Exit(1)
  21. }
  22. app, err := app.NewApp(cfg)
  23. if err != nil {
  24. fmt.Println("Error creating the app: ", err)
  25. return
  26. }
  27. err = app.Run()
  28. if err != nil {
  29. fmt.Println("Error running the app: ", err)
  30. os.Exit(1)
  31. }
  32. }