From 9dfb7de3715c11e9569de62cd03b7787e58d0d91 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 26 Apr 2014 01:22:22 -0600 Subject: [PATCH] Fix #102 --- README.md | 5 ++ README_ZH.md | 6 +++ doc/install_gogs_from_binary_on_ubuntu.md | 4 +- gogs.go | 2 +- modules/base/conf.go | 58 ++++++++++++----------- 5 files changed, 45 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 0387807219..d188508ec6 100644 --- a/README.md +++ b/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. - 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. diff --git a/README_ZH.md b/README_ZH.md index 6d7553a684..bbf461ddf6 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -33,6 +33,12 @@ Gogs 完全使用 Go 语言来实现对 Git 数据的操作,实现 **零** 依 - 支持 MySQL、PostgreSQL 以及 SQLite3 数据库 - 社交帐号登录(GitHub、Google、QQ、微博) +## 系统要求 + +- 最低的系统硬件要求为一个廉价的树莓派 +- 如果用于团队项目,建议使用 4 核 CPU 及 1GB 内存 + + ## 安装部署 在安装 Gogs 之前,您需要先安装 [基本环境](https://github.com/gogits/gogs/wiki/Prerequirements)。 diff --git a/doc/install_gogs_from_binary_on_ubuntu.md b/doc/install_gogs_from_binary_on_ubuntu.md index 6d004106cf..3b406b3643 100644 --- a/doc/install_gogs_from_binary_on_ubuntu.md +++ b/doc/install_gogs_from_binary_on_ubuntu.md @@ -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 diff --git a/gogs.go b/gogs.go index b06c80064c..caa8cf63db 100644 --- a/gogs.go +++ b/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 diff --git a/modules/base/conf.go b/modules/base/conf.go index 04c1245774..e89c67bc1b 100644 --- a/modules/base/conf.go +++ b/modules/base/conf.go @@ -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()