Move the 8899 integer and string literals into a const named DefaultApiServerPort in shared (#367)

This commit is contained in:
M. Mert Yıldıran
2021-10-17 15:28:33 +03:00
committed by GitHub
parent 9d179c7227
commit 167b17dfd2
4 changed files with 9 additions and 4 deletions

View File

@@ -2,6 +2,7 @@ package utils
import (
"context"
"fmt"
"net/http"
"net/url"
"os"
@@ -11,6 +12,7 @@ import (
"time"
"github.com/gin-gonic/gin"
"github.com/up9inc/mizu/shared"
"github.com/up9inc/mizu/shared/logger"
)
@@ -37,7 +39,7 @@ func StartServer(app *gin.Engine) {
// Run server.
logger.Log.Infof("Starting the server...")
if err := app.Run(":8899"); err != nil {
if err := app.Run(fmt.Sprintf(":%d", shared.DefaultApiServerPort)); err != nil {
logger.Log.Errorf("Server is not running! Reason: %v", err)
}
}