Browse Source

Fix #102

pull/132/head
Unknown 11 years ago
parent
commit
9dfb7de371
  1. 5
      README.md
  2. 6
      README_ZH.md
  3. 4
      doc/install_gogs_from_binary_on_ubuntu.md
  4. 2
      gogs.go
  5. 58
      modules/base/conf.go

5
README.md

@ -42,6 +42,11 @@ More importantly, Gogs only needs one binary to setup your own project hosting o
- Supports MySQL, PostgreSQL and SQLite3. - Supports MySQL, PostgreSQL and SQLite3.
- Social account login(GitHub, Google, QQ, Weibo) - 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 ## Installation
Make sure you install [Prerequirements](https://github.com/gogits/gogs/wiki/Prerequirements) first. Make sure you install [Prerequirements](https://github.com/gogits/gogs/wiki/Prerequirements) first.

6
README_ZH.md

@ -33,6 +33,12 @@ Gogs 完全使用 Go 语言来实现对 Git 数据的操作,实现 **零** 依
- 支持 MySQL、PostgreSQL 以及 SQLite3 数据库 - 支持 MySQL、PostgreSQL 以及 SQLite3 数据库
- 社交帐号登录(GitHub、Google、QQ、微博) - 社交帐号登录(GitHub、Google、QQ、微博)
## 系统要求
- 最低的系统硬件要求为一个廉价的树莓派
- 如果用于团队项目,建议使用 4 核 CPU 及 1GB 内存
## 安装部署 ## 安装部署
在安装 Gogs 之前,您需要先安装 [基本环境](https://github.com/gogits/gogs/wiki/Prerequirements)。 在安装 Gogs 之前,您需要先安装 [基本环境](https://github.com/gogits/gogs/wiki/Prerequirements)。

4
doc/install_gogs_from_binary_on_ubuntu.md

@ -18,8 +18,8 @@
### install the gogs ### install the gogs
- mkdir gogs - mkdir gogs
- cd gogs - cd gogs
- curl -L http://gobuild.io/github.com/gogits/gogs/v0.2.0/linux/amd64 -o 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.2.0.zip - unzip v0.3.0.zip
- ./start.sh - ./start.sh
> The up-to-date binary could be found at > The up-to-date binary could be found at

2
gogs.go

@ -19,7 +19,7 @@ import (
// Test that go1.2 tag above is included in builds. main.go refers to this definition. // Test that go1.2 tag above is included in builds. main.go refers to this definition.
const go12tag = true const go12tag = true
const APP_VER = "0.3.0.0422 Alpha" const APP_VER = "0.3.0.0426 Alpha"
func init() { func init() {
base.AppVer = APP_VER base.AppVer = APP_VER

58
modules/base/conf.go

@ -178,6 +178,36 @@ func newLogService() {
log.Info("Log Mode: %s(%s)", strings.Title(LogMode), levelName) 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() { func newCacheService() {
CacheAdapter = Cfg.MustValue("cache", "ADAPTER", "memory") CacheAdapter = Cfg.MustValue("cache", "ADAPTER", "memory")
if EnableRedis { if EnableRedis {
@ -313,33 +343,6 @@ func NewConfigContext() {
CookieUserName = Cfg.MustValue("security", "COOKIE_USERNAME") CookieUserName = Cfg.MustValue("security", "COOKIE_USERNAME")
CookieRememberName = Cfg.MustValue("security", "COOKIE_REMEMBER_NAME") 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") PictureService = Cfg.MustValue("picture", "SERVICE")
// Determine and create root git reposiroty path. // Determine and create root git reposiroty path.
@ -357,6 +360,7 @@ func NewConfigContext() {
func NewBaseServices() { func NewBaseServices() {
newService() newService()
newLogService() newLogService()
newLdapService()
newCacheService() newCacheService()
newSessionService() newSessionService()
newMailService() newMailService()

Loading…
Cancel
Save