aboutsummaryrefslogtreecommitdiff
path: root/modules/base/conf.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2014-04-14 14:50:37 +0800
committerLunny Xiao <xiaolunwen@gmail.com>2014-04-14 14:50:37 +0800
commit8283e16ef7af197ee77b1be412bf875ae97c789e (patch)
treec145517a3b885c49408f35e0cb9c9aabe6201a35 /modules/base/conf.go
parent6cee65db5a6e6ef7372f19d45c22a416e130afed (diff)
parentf644cefa865c04b440902695ba90114b224c640d (diff)
Merge branch 'dev' of github.com:gogits/gogs into dev
Diffstat (limited to 'modules/base/conf.go')
-rw-r--r--modules/base/conf.go37
1 files changed, 10 insertions, 27 deletions
diff --git a/modules/base/conf.go b/modules/base/conf.go
index d1564aa1..957ec57b 100644
--- a/modules/base/conf.go
+++ b/modules/base/conf.go
@@ -29,13 +29,17 @@ type Mailer struct {
User, Passwd string
}
+type OauthInfo struct {
+ ClientId, ClientSecret string
+ Scopes string
+ AuthUrl, TokenUrl string
+}
+
// Oauther represents oauth service.
type Oauther struct {
- GitHub struct {
- Enabled bool
- ClientId, ClientSecret string
- Scopes string
- }
+ GitHub, Google, Tencent bool
+ Twitter, Weibo bool
+ OauthInfos map[string]*OauthInfo
}
var (
@@ -252,26 +256,6 @@ func newNotifyMailService() {
log.Info("Notify Mail Service Enabled")
}
-func newOauthService() {
- if !Cfg.MustBool("oauth", "ENABLED") {
- return
- }
-
- OauthService = &Oauther{}
- oauths := make([]string, 0, 10)
-
- // GitHub.
- if Cfg.MustBool("oauth.github", "ENABLED") {
- OauthService.GitHub.Enabled = true
- OauthService.GitHub.ClientId = Cfg.MustValue("oauth.github", "CLIENT_ID")
- OauthService.GitHub.ClientSecret = Cfg.MustValue("oauth.github", "CLIENT_SECRET")
- OauthService.GitHub.Scopes = Cfg.MustValue("oauth.github", "SCOPES")
- oauths = append(oauths, "GitHub")
- }
-
- log.Info("Oauth Service Enabled %s", oauths)
-}
-
func NewConfigContext() {
//var err error
workDir, err := ExecDir()
@@ -328,7 +312,7 @@ func NewConfigContext() {
}
}
-func NewServices() {
+func NewBaseServices() {
newService()
newLogService()
newCacheService()
@@ -336,5 +320,4 @@ func NewServices() {
newMailService()
newRegisterMailService()
newNotifyMailService()
- newOauthService()
}