package server import ( "encoding/json" "io/ioutil" "os" "vegvisir/config" ) type Server struct { Config config.Config } func NewServer() Server { return Server{} } func (s *Server) LoadConfig(file string) error { if _, err := os.Stat(file); err != nil { return err } data, err := ioutil.ReadFile(file) if err != nil { return err } json.Unmarshal(data, &s.Config) return nil } // func Run(s *Server) { // s.StartListener() // log.Println("Server started successfully...") // Wait for an interrupt // c := make(chan os.Signal, 1) // signal.Notify(c, os.Interrupt, os.Kill) // <-c // log.Error("SIGKILL or SIGINT caught, shutting down...") // Attempt a graceful shutdown // ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) // defer cancel() // s.shutdownServers(ctx) // log.Error("all listeners shut down.") // }