mirror of
				https://github.com/grafana/grafana.git
				synced 2025-02-25 18:55:37 -06:00 
			
		
		
		
	before macaron
This commit is contained in:
		@@ -53,11 +53,10 @@ func apiLogger() gin.HandlerFunc {
 | 
			
		||||
 | 
			
		||||
		end := time.Now()
 | 
			
		||||
		latency := end.Sub(start)
 | 
			
		||||
		log.Info("[http] %s %s %3d %12v %s %s",
 | 
			
		||||
		log.Info("[http] %s %s %3d %12v %s",
 | 
			
		||||
			c.Request.Method, c.Request.URL.Path,
 | 
			
		||||
			code,
 | 
			
		||||
			latency,
 | 
			
		||||
			requester,
 | 
			
		||||
			c.Errors.String(),
 | 
			
		||||
		)
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,14 +1,13 @@
 | 
			
		||||
package cmd
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"os"
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
	"github.com/codegangsta/cli"
 | 
			
		||||
	"github.com/siddontang/go-log/log"
 | 
			
		||||
	"github.com/torkelo/grafana-pro/pkg/configuration"
 | 
			
		||||
	"github.com/torkelo/grafana-pro/pkg/routes"
 | 
			
		||||
	"github.com/torkelo/grafana-pro/pkg/server"
 | 
			
		||||
	"github.com/torkelo/grafana-pro/pkg/setting"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var CmdWeb = cli.Command{
 | 
			
		||||
@@ -20,15 +19,11 @@ var CmdWeb = cli.Command{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func runWeb(*cli.Context) {
 | 
			
		||||
	routes.GlobalInit()
 | 
			
		||||
	port := os.Getenv("PORT")
 | 
			
		||||
	if port == "" {
 | 
			
		||||
		port = "3838"
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	log.Info("Starting Grafana-Pro v.1-alpha")
 | 
			
		||||
 | 
			
		||||
	cfg := configuration.NewCfg(port)
 | 
			
		||||
	setting.NewConfigContext()
 | 
			
		||||
 | 
			
		||||
	cfg := configuration.NewCfg(setting.HttpPort)
 | 
			
		||||
	server, err := server.NewServer(cfg)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		time.Sleep(time.Second)
 | 
			
		||||
 
 | 
			
		||||
@@ -122,4 +122,9 @@ func NewConfigContext() {
 | 
			
		||||
	Domain = Cfg.MustValue("server", "domain", "localhost")
 | 
			
		||||
	HttpAddr = Cfg.MustValue("server", "http_addr", "0.0.0.0")
 | 
			
		||||
	HttpPort = Cfg.MustValue("server", "http_port", "3000")
 | 
			
		||||
 | 
			
		||||
	port := os.Getenv("PORT")
 | 
			
		||||
	if port != "" {
 | 
			
		||||
		HttpPort = port
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user