Skip to content

Commit

Permalink
Merge pull request #1139 from sundowndev/chore/gin-release-mode
Browse files Browse the repository at this point in the history
Set gin mode in build releases
  • Loading branch information
sundowndev committed Sep 26, 2022
2 parents 0d93557 + 9e8f6be commit fbe1202
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmd/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ package cmd

import (
"fmt"
"github.com/gin-gonic/gin"
"github.com/spf13/cobra"
"github.com/sundowndev/phoneinfoga/v2/build"
"github.com/sundowndev/phoneinfoga/v2/web"
"log"
"net/http"
"os"
)

var httpPort int
Expand All @@ -24,6 +27,10 @@ var serveCmd = &cobra.Command{
Use: "serve",
Short: "Serve web client",
Run: func(cmd *cobra.Command, args []string) {
if build.IsRelease() && os.Getenv("GIN_MODE") == "" {
gin.SetMode(gin.ReleaseMode)
}

srv, err := web.NewServer(disableClient)
if err != nil {
log.Fatal(err)
Expand Down

0 comments on commit fbe1202

Please sign in to comment.