Fix grabage codes 5 years ago

Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
2025-12-23 23:46:00 +08:00
parent b933522123
commit 485d0de64b
8 changed files with 21 additions and 44 deletions

View File

@@ -2,12 +2,12 @@ package server
import (
"net/http"
"nixcn-cms/config"
"nixcn-cms/logger"
"time"
"github.com/gin-gonic/gin"
log "github.com/sirupsen/logrus"
"github.com/spf13/viper"
)
func Start() {
@@ -18,14 +18,14 @@ func Start() {
// Start http server
server := &http.Server{
Addr: config.Get("server.address").(string),
Addr: viper.GetString("server.address"),
Handler: r,
ReadTimeout: 10 * time.Second,
WriteTimeout: 10 * time.Second,
MaxHeaderBytes: 1 << 20,
}
log.Info("Starting server on " + config.Get("server.address").(string))
log.Info("Starting server on " + viper.GetString("server.address"))
if err := server.ListenAndServe(); err != nil {
log.Errorf("Error starting server: %v\n", err)
}