package initialization

import (
	"github.com/spf13/viper"
	"net/http"
	"time"
)

func RunServer() {
	port := viper.GetString("system.port")
	r := InitRouter()
	s := &http.Server{
		Addr:           port,
		Handler:        r,
		ReadTimeout:    120 * time.Second,
		WriteTimeout:   120 * time.Second,
		MaxHeaderBytes: 1 << 20,
	}
	println("run on port", port)
	if err := s.ListenAndServe(); err != nil {
		panic(err)
	}
}
