gogs.go 831 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Copyright 2014 The Gogs Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package main
  5. import (
  6. "fmt"
  7. "net/http"
  8. "github.com/codegangsta/martini"
  9. "github.com/martini-contrib/render"
  10. "github.com/gogits/gogs/routers"
  11. "github.com/gogits/gogs/utils"
  12. "github.com/gogits/gogs/utils/log"
  13. )
  14. const APP_VER = "0.0.0.0212"
  15. func init() {
  16. }
  17. func main() {
  18. log.Info("App Name: %s", utils.Cfg.MustValue("", "APP_NAME"))
  19. m := martini.Classic()
  20. // Middleware.
  21. m.Use(render.Renderer())
  22. // Routers.
  23. m.Get("/", routers.Dashboard)
  24. listenAddr := fmt.Sprintf("%s:%s",
  25. utils.Cfg.MustValue("server", "HTTP_ADDR"),
  26. utils.Cfg.MustValue("server", "HTTP_PORT", "3000"))
  27. log.Info("Listen: %s", listenAddr)
  28. http.ListenAndServe(listenAddr, m)
  29. }