mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-27 22:23:50 +03:00
Fix #102
This commit is contained in:
parent
861a20f464
commit
9dfb7de371
5 changed files with 45 additions and 30 deletions
|
@ -42,6 +42,11 @@ More importantly, Gogs only needs one binary to setup your own project hosting o
|
|||
- Supports MySQL, PostgreSQL and SQLite3.
|
||||
- Social account login(GitHub, Google, QQ, Weibo)
|
||||
|
||||
## System Requirements
|
||||
|
||||
- A cheap Raspberry Pi is powerful enough to match the minimal requirement.
|
||||
- 4 CPU Cores and 1GB RAM would be the baseline for teamwork.
|
||||
|
||||
## Installation
|
||||
|
||||
Make sure you install [Prerequirements](https://github.com/gogits/gogs/wiki/Prerequirements) first.
|
||||
|
|
|
@ -33,6 +33,12 @@ Gogs 完全使用 Go 语言来实现对 Git 数据的操作,实现 **零** 依
|
|||
- 支持 MySQL、PostgreSQL 以及 SQLite3 数据库
|
||||
- 社交帐号登录(GitHub、Google、QQ、微博)
|
||||
|
||||
## 系统要求
|
||||
|
||||
- 最低的系统硬件要求为一个廉价的树莓派
|
||||
- 如果用于团队项目,建议使用 4 核 CPU 及 1GB 内存
|
||||
|
||||
|
||||
## 安装部署
|
||||
|
||||
在安装 Gogs 之前,您需要先安装 [基本环境](https://github.com/gogits/gogs/wiki/Prerequirements)。
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
### install the gogs
|
||||
- mkdir gogs
|
||||
- cd gogs
|
||||
- curl -L http://gobuild.io/github.com/gogits/gogs/v0.2.0/linux/amd64 -o v0.2.0.zip
|
||||
- unzip v0.2.0.zip
|
||||
- curl -L http://gobuild.io/github.com/gogits/gogs/v0.3.0/linux/amd64 -o v0.3.0.zip
|
||||
- unzip v0.3.0.zip
|
||||
- ./start.sh
|
||||
|
||||
> The up-to-date binary could be found at
|
||||
|
|
2
gogs.go
2
gogs.go
|
@ -19,7 +19,7 @@ import (
|
|||
// Test that go1.2 tag above is included in builds. main.go refers to this definition.
|
||||
const go12tag = true
|
||||
|
||||
const APP_VER = "0.3.0.0422 Alpha"
|
||||
const APP_VER = "0.3.0.0426 Alpha"
|
||||
|
||||
func init() {
|
||||
base.AppVer = APP_VER
|
||||
|
|
|
@ -178,6 +178,36 @@ func newLogService() {
|
|||
log.Info("Log Mode: %s(%s)", strings.Title(LogMode), levelName)
|
||||
}
|
||||
|
||||
func newLdapService() {
|
||||
LdapAuth = Cfg.MustBool("security", "LDAP_AUTH", false)
|
||||
if !LdapAuth {
|
||||
return
|
||||
}
|
||||
|
||||
nbsrc := 0
|
||||
for _, v := range Cfg.GetSectionList() {
|
||||
if matched, _ := regexp.MatchString("(?i)^LDAPSOURCE.*", v); matched {
|
||||
ldapname := Cfg.MustValue(v, "name", v)
|
||||
ldaphost := Cfg.MustValue(v, "host")
|
||||
ldapport := Cfg.MustInt(v, "port", 389)
|
||||
ldapbasedn := Cfg.MustValue(v, "basedn", "dc=*,dc=*")
|
||||
ldapattribute := Cfg.MustValue(v, "attribute", "mail")
|
||||
ldapfilter := Cfg.MustValue(v, "filter", "(*)")
|
||||
ldapmsadsaformat := Cfg.MustValue(v, "MSADSAFORMAT", "%s")
|
||||
ldap.AddSource(ldapname, ldaphost, ldapport, ldapbasedn, ldapattribute, ldapfilter, ldapmsadsaformat)
|
||||
nbsrc++
|
||||
log.Debug("%s added as LDAP source", ldapname)
|
||||
}
|
||||
}
|
||||
if nbsrc == 0 {
|
||||
log.Warn("No valide LDAP found, LDAP Authentication NOT enabled")
|
||||
LdapAuth = false
|
||||
return
|
||||
}
|
||||
|
||||
log.Info("LDAP Authentication Enabled")
|
||||
}
|
||||
|
||||
func newCacheService() {
|
||||
CacheAdapter = Cfg.MustValue("cache", "ADAPTER", "memory")
|
||||
if EnableRedis {
|
||||
|
@ -313,33 +343,6 @@ func NewConfigContext() {
|
|||
CookieUserName = Cfg.MustValue("security", "COOKIE_USERNAME")
|
||||
CookieRememberName = Cfg.MustValue("security", "COOKIE_REMEMBER_NAME")
|
||||
|
||||
// load LDAP authentication configuration if present
|
||||
LdapAuth = Cfg.MustBool("security", "LDAP_AUTH", false)
|
||||
if LdapAuth {
|
||||
qlog.Debug("LDAP AUTHENTICATION activated")
|
||||
nbsrc := 0
|
||||
for _, v := range Cfg.GetSectionList() {
|
||||
if matched, _ := regexp.MatchString("(?i)^LDAPSOURCE.*", v); matched {
|
||||
ldapname := Cfg.MustValue(v, "name", v)
|
||||
ldaphost := Cfg.MustValue(v, "host")
|
||||
ldapport := Cfg.MustInt(v, "port", 389)
|
||||
ldapbasedn := Cfg.MustValue(v, "basedn", "dc=*,dc=*")
|
||||
ldapattribute := Cfg.MustValue(v, "attribute", "mail")
|
||||
ldapfilter := Cfg.MustValue(v, "filter", "(*)")
|
||||
ldapmsadsaformat := Cfg.MustValue(v, "MSADSAFORMAT", "%s")
|
||||
ldap.AddSource(ldapname, ldaphost, ldapport, ldapbasedn, ldapattribute, ldapfilter, ldapmsadsaformat)
|
||||
nbsrc += 1
|
||||
qlog.Debug("%s added as LDAP source", ldapname)
|
||||
}
|
||||
}
|
||||
if nbsrc == 0 {
|
||||
qlog.Debug("No valide LDAP found, LDAP AUTHENTICATION NOT activated")
|
||||
LdapAuth = false
|
||||
}
|
||||
} else {
|
||||
qlog.Debug("LDAP AUTHENTICATION NOT activated")
|
||||
}
|
||||
|
||||
PictureService = Cfg.MustValue("picture", "SERVICE")
|
||||
|
||||
// Determine and create root git reposiroty path.
|
||||
|
@ -357,6 +360,7 @@ func NewConfigContext() {
|
|||
func NewBaseServices() {
|
||||
newService()
|
||||
newLogService()
|
||||
newLdapService()
|
||||
newCacheService()
|
||||
newSessionService()
|
||||
newMailService()
|
||||
|
|
Loading…
Reference in a new issue