mirror of
https://gitcode.com/gitea/gitea.git
synced 2025-06-05 12:06:41 +08:00
Merge utils to modules
This commit is contained in:
@ -12,7 +12,7 @@ import (
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
"github.com/lunny/xorm"
|
||||
|
||||
"github.com/gogits/gogs/utils"
|
||||
"github.com/gogits/gogs/modules/base"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -41,11 +41,11 @@ type Comment struct {
|
||||
}
|
||||
|
||||
func setEngine() {
|
||||
dbType := utils.Cfg.MustValue("database", "DB_TYPE")
|
||||
dbHost := utils.Cfg.MustValue("database", "HOST")
|
||||
dbName := utils.Cfg.MustValue("database", "NAME")
|
||||
dbUser := utils.Cfg.MustValue("database", "USER")
|
||||
dbPwd := utils.Cfg.MustValue("database", "PASSWD")
|
||||
dbType := base.Cfg.MustValue("database", "DB_TYPE")
|
||||
dbHost := base.Cfg.MustValue("database", "HOST")
|
||||
dbName := base.Cfg.MustValue("database", "NAME")
|
||||
dbUser := base.Cfg.MustValue("database", "USER")
|
||||
dbPwd := base.Cfg.MustValue("database", "PASSWD")
|
||||
|
||||
uname, err := user.Current()
|
||||
if err != nil {
|
||||
@ -54,7 +54,7 @@ func setEngine() {
|
||||
}
|
||||
|
||||
if uname.Username == "jiahuachen" {
|
||||
dbPwd = utils.Cfg.MustValue("database", "PASSWD_jiahua")
|
||||
dbPwd = base.Cfg.MustValue("database", "PASSWD_jiahua")
|
||||
}
|
||||
|
||||
switch dbType {
|
||||
@ -82,9 +82,9 @@ func setEngine() {
|
||||
|
||||
//log.Trace("Initialized database -> %s", dbName)
|
||||
|
||||
RepoRootPath = utils.Cfg.MustValue("repository", "ROOT")
|
||||
RepoRootPath = base.Cfg.MustValue("repository", "ROOT")
|
||||
if uname.Username == "jiahuachen" {
|
||||
RepoRootPath = utils.Cfg.MustValue("repository", "ROOT_jiahuachen")
|
||||
RepoRootPath = base.Cfg.MustValue("repository", "ROOT_jiahuachen")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,8 +10,9 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/gogits/gogs/utils/log"
|
||||
git "github.com/libgit2/git2go"
|
||||
|
||||
"github.com/gogits/gogs/modules/log"
|
||||
)
|
||||
|
||||
type Repo struct {
|
||||
|
@ -14,13 +14,13 @@ import (
|
||||
|
||||
"github.com/dchest/scrypt"
|
||||
|
||||
"github.com/gogits/gogs/utils"
|
||||
"github.com/gogits/gogs/modules/base"
|
||||
)
|
||||
|
||||
var UserPasswdSalt string
|
||||
|
||||
func init() {
|
||||
UserPasswdSalt = utils.Cfg.MustValue("security", "USER_PASSWD_SALT")
|
||||
UserPasswdSalt = base.Cfg.MustValue("security", "USER_PASSWD_SALT")
|
||||
}
|
||||
|
||||
// User types.
|
||||
@ -115,7 +115,7 @@ func RegisterUser(user *User) (err error) {
|
||||
}
|
||||
|
||||
user.LowerName = strings.ToLower(user.Name)
|
||||
user.Avatar = utils.EncodeMd5(user.Email)
|
||||
user.Avatar = base.EncodeMd5(user.Email)
|
||||
if err = user.EncodePasswd(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user