install.go 823 B

123456789101112131415161718192021222324252627282930313233
  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 routers
  5. import (
  6. "errors"
  7. "github.com/gogits/gogs/models"
  8. "github.com/gogits/gogs/modules/auth"
  9. "github.com/gogits/gogs/modules/base"
  10. "github.com/gogits/gogs/modules/middleware"
  11. )
  12. func Install(ctx *middleware.Context, form auth.InstallForm) {
  13. if base.InstallLock {
  14. ctx.Handle(404, "install.Install", errors.New("Installation is prohibited"))
  15. return
  16. }
  17. ctx.Data["Title"] = "Install"
  18. ctx.Data["DbCfg"] = models.DbCfg
  19. ctx.Data["RepoRootPath"] = base.RepoRootPath
  20. ctx.Data["RunUser"] = base.RunUser
  21. ctx.Data["AppUrl"] = base.AppUrl
  22. ctx.Data["PageIsInstall"] = true
  23. if ctx.Req.Method == "GET" {
  24. ctx.HTML(200, "install")
  25. return
  26. }
  27. }