mirror of
https://github.com/go-gitea/gitea
synced 2024-11-16 07:04:25 +00:00
Merge branch 'master' of github.com:gogits/gogs into dev
This commit is contained in:
commit
5378bb326b
@ -89,8 +89,16 @@ func SetEngine() (err error) {
|
|||||||
orm, err = xorm.NewEngine("mysql", fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8",
|
orm, err = xorm.NewEngine("mysql", fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8",
|
||||||
DbCfg.User, DbCfg.Pwd, DbCfg.Host, DbCfg.Name))
|
DbCfg.User, DbCfg.Pwd, DbCfg.Host, DbCfg.Name))
|
||||||
case "postgres":
|
case "postgres":
|
||||||
orm, err = xorm.NewEngine("postgres", fmt.Sprintf("user=%s password=%s dbname=%s sslmode=%s",
|
var host, port = "127.0.0.1", "5432"
|
||||||
DbCfg.User, DbCfg.Pwd, DbCfg.Name, DbCfg.SslMode))
|
fields := strings.Split(DbCfg.Host, ":")
|
||||||
|
if len(fields) > 0 {
|
||||||
|
host = fields[0]
|
||||||
|
}
|
||||||
|
if len(fields) > 1 {
|
||||||
|
port = fields[1]
|
||||||
|
}
|
||||||
|
orm, err = xorm.NewEngine("postgres", fmt.Sprintf("user=%s password=%s host=%s port=%s dbname=%s sslmode=%s",
|
||||||
|
DbCfg.User, DbCfg.Pwd, host, port, DbCfg.Name, DbCfg.SslMode))
|
||||||
case "sqlite3":
|
case "sqlite3":
|
||||||
os.MkdirAll(path.Dir(DbCfg.Path), os.ModePerm)
|
os.MkdirAll(path.Dir(DbCfg.Path), os.ModePerm)
|
||||||
orm, err = xorm.NewEngine("sqlite3", DbCfg.Path)
|
orm, err = xorm.NewEngine("sqlite3", DbCfg.Path)
|
||||||
|
@ -76,7 +76,7 @@ func (user *User) AvatarLink() string {
|
|||||||
if base.Service.EnableCacheAvatar {
|
if base.Service.EnableCacheAvatar {
|
||||||
return "/avatar/" + user.Avatar
|
return "/avatar/" + user.Avatar
|
||||||
}
|
}
|
||||||
return "http://1.gravatar.com/avatar/" + user.Avatar
|
return "//1.gravatar.com/avatar/" + user.Avatar
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewGitSig generates and returns the signature of given user.
|
// NewGitSig generates and returns the signature of given user.
|
||||||
|
@ -143,7 +143,7 @@ func AvatarLink(email string) string {
|
|||||||
if Service.EnableCacheAvatar {
|
if Service.EnableCacheAvatar {
|
||||||
return "/avatar/" + EncodeMd5(email)
|
return "/avatar/" + EncodeMd5(email)
|
||||||
}
|
}
|
||||||
return "http://1.gravatar.com/avatar/" + EncodeMd5(email)
|
return "//1.gravatar.com/avatar/" + EncodeMd5(email)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Seconds-based time units
|
// Seconds-based time units
|
||||||
|
Loading…
Reference in New Issue
Block a user