2014-08-08 05:35:15 -05:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
log "github.com/alecthomas/log4go"
|
2014-09-22 03:46:13 -05:00
|
|
|
"github.com/torkelo/grafana-pro/pkg/configuration"
|
2014-08-12 13:45:41 -05:00
|
|
|
"github.com/torkelo/grafana-pro/pkg/server"
|
2014-08-08 05:35:15 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
port := os.Getenv("PORT")
|
|
|
|
if port == "" {
|
|
|
|
port = "3838"
|
|
|
|
}
|
|
|
|
|
|
|
|
log.Info("Starting Grafana-Pro v.1-alpha")
|
|
|
|
|
2014-09-22 03:46:13 -05:00
|
|
|
cfg := configuration.NewCfg(port)
|
|
|
|
server, err := server.NewServer(cfg)
|
2014-08-08 05:35:15 -05:00
|
|
|
if err != nil {
|
|
|
|
time.Sleep(time.Second)
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
err = server.ListenAndServe()
|
|
|
|
if err != nil {
|
|
|
|
log.Error("ListenAndServe failed: ", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
time.Sleep(time.Millisecond * 2000)
|
|
|
|
}
|