mirror of https://github.com/go-gitea/gitea.git
Add some config options
This commit is contained in:
parent
d886f4df97
commit
a3a93aef11
26
conf/app.ini
26
conf/app.ini
|
@ -1,12 +1,14 @@
|
||||||
# App name that shows on every page title
|
; App name that shows on every page title
|
||||||
APP_NAME = Gogs: Go Git Service
|
APP_NAME = Gogs: Go Git Service
|
||||||
# !!MUST CHANGE TO YOUR USER NAME!!
|
; !!MUST CHANGE TO YOUR USER NAME!!
|
||||||
RUN_USER = lunny
|
RUN_USER = lunny
|
||||||
|
; Either "dev", "prod" or "test", based on martini
|
||||||
|
RUN_MODE = dev
|
||||||
|
|
||||||
[repository]
|
[repository]
|
||||||
ROOT = /Users/%(RUN_USER)s/git/gogs-repositories
|
ROOT = /Users/%(RUN_USER)s/git/gogs-repositories
|
||||||
LANG_IGNS=Google Go|C|Python|Ruby|C Sharp
|
LANG_IGNS = Google Go|C|Python|Ruby|C Sharp
|
||||||
LICENSES=Apache v2 License|GPL v2|MIT License|Affero GPL|BSD (3-Clause) License
|
LICENSES = Apache v2 License|GPL v2|MIT License|Affero GPL|BSD (3-Clause) License
|
||||||
|
|
||||||
[server]
|
[server]
|
||||||
DOMAIN = gogits.org
|
DOMAIN = gogits.org
|
||||||
|
@ -14,15 +16,25 @@ HTTP_ADDR =
|
||||||
HTTP_PORT = 3000
|
HTTP_PORT = 3000
|
||||||
|
|
||||||
[database]
|
[database]
|
||||||
# Either "mysql" or "postgres", it's your choice
|
; Either "mysql" or "postgres", it's your choice
|
||||||
DB_TYPE = mysql
|
DB_TYPE = mysql
|
||||||
HOST =
|
HOST =
|
||||||
NAME = gogs
|
NAME = gogs
|
||||||
USER = root
|
USER = root
|
||||||
PASSWD =
|
PASSWD =
|
||||||
# For "postgres" only, either "disable" or "verify-full"
|
; For "postgres" only, either "disable", "require" or "verify-full"
|
||||||
SSL_MODE = disable
|
SSL_MODE = disable
|
||||||
|
|
||||||
[security]
|
[security]
|
||||||
# !!CHANGE THIS TO KEEP YOUR USER DATA SAFE!!
|
; !!CHANGE THIS TO KEEP YOUR USER DATA SAFE!!
|
||||||
USER_PASSWD_SALT = !#@FDEWREWR&*(
|
USER_PASSWD_SALT = !#@FDEWREWR&*(
|
||||||
|
|
||||||
|
[mailer]
|
||||||
|
ENABLED = true
|
||||||
|
; Name displayed in mail title
|
||||||
|
NAME = %(APP_NAME)s
|
||||||
|
; Mail server
|
||||||
|
HOST =
|
||||||
|
; Mailer user name and password
|
||||||
|
USER =
|
||||||
|
PASSWD =
|
|
@ -252,7 +252,7 @@ func LoginUserPlain(name, passwd string) (*User, error) {
|
||||||
} else if !has {
|
} else if !has {
|
||||||
err = ErrUserNotExist
|
err = ErrUserNotExist
|
||||||
}
|
}
|
||||||
return &user, nil
|
return &user, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// FollowUser marks someone be another's follower.
|
// FollowUser marks someone be another's follower.
|
||||||
|
|
|
@ -13,13 +13,23 @@ import (
|
||||||
|
|
||||||
"github.com/Unknwon/com"
|
"github.com/Unknwon/com"
|
||||||
"github.com/Unknwon/goconfig"
|
"github.com/Unknwon/goconfig"
|
||||||
|
|
||||||
|
"github.com/gogits/gogs/modules/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Mailer represents a mail service.
|
||||||
|
type Mailer struct {
|
||||||
|
Name string
|
||||||
|
Host string
|
||||||
|
User, Passwd string
|
||||||
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
AppVer string
|
AppVer string
|
||||||
AppName string
|
AppName string
|
||||||
Domain string
|
Domain string
|
||||||
Cfg *goconfig.ConfigFile
|
Cfg *goconfig.ConfigFile
|
||||||
|
MailService *Mailer
|
||||||
)
|
)
|
||||||
|
|
||||||
func exeDir() (string, error) {
|
func exeDir() (string, error) {
|
||||||
|
@ -59,6 +69,17 @@ func init() {
|
||||||
}
|
}
|
||||||
Cfg.BlockMode = false
|
Cfg.BlockMode = false
|
||||||
|
|
||||||
AppName = Cfg.MustValue("", "APP_NAME")
|
AppName = Cfg.MustValue("", "APP_NAME", "Gogs: Go Git Service")
|
||||||
Domain = Cfg.MustValue("server", "DOMAIN")
|
Domain = Cfg.MustValue("server", "DOMAIN")
|
||||||
|
|
||||||
|
// Check mailer setting.
|
||||||
|
if Cfg.MustBool("mailer", "ENABLED") {
|
||||||
|
MailService = &Mailer{
|
||||||
|
Name: Cfg.MustValue("mailer", "NAME", AppName),
|
||||||
|
Host: Cfg.MustValue("mailer", "HOST", "127.0.0.1:25"),
|
||||||
|
User: Cfg.MustValue("mailer", "USER", "example@example.com"),
|
||||||
|
Passwd: Cfg.MustValue("mailer", "PASSWD", "******"),
|
||||||
|
}
|
||||||
|
log.Info("Mail Service Enabled")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
13
web.go
13
web.go
|
@ -8,6 +8,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"html/template"
|
"html/template"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/codegangsta/cli"
|
"github.com/codegangsta/cli"
|
||||||
"github.com/codegangsta/martini"
|
"github.com/codegangsta/martini"
|
||||||
|
@ -34,8 +35,20 @@ gogs web`,
|
||||||
Flags: []cli.Flag{},
|
Flags: []cli.Flag{},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check run mode(Default of martini is Dev).
|
||||||
|
func checkRunMode() {
|
||||||
|
switch base.Cfg.MustValue("", "RUN_MODE") {
|
||||||
|
case "prod":
|
||||||
|
martini.Env = martini.Prod
|
||||||
|
case "test":
|
||||||
|
martini.Env = martini.Test
|
||||||
|
}
|
||||||
|
log.Info("Run Mode: %s", strings.Title(martini.Env))
|
||||||
|
}
|
||||||
|
|
||||||
func runWeb(*cli.Context) {
|
func runWeb(*cli.Context) {
|
||||||
log.Info("%s %s", base.AppName, base.AppVer)
|
log.Info("%s %s", base.AppName, base.AppVer)
|
||||||
|
checkRunMode()
|
||||||
|
|
||||||
m := martini.Classic()
|
m := martini.Classic()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue