conf: overhaul server settings (#5928)

* conf: rename package

* Requires Go 1.12

* Fix lint

* Fix lint

* Overhaul

* db: fix tests

* Save my work

* Fix tests

* Server.UnixSocketPermission

* Server.LocalRootURL

* SSH settings

* Server.OfflineMode

* Save my work

* App.Version

* Remove [server] STATIC_ROOT_PATH

* Server.LandingURL
This commit is contained in:
ᴜɴᴋɴᴡᴏɴ
2020-02-22 09:05:26 +08:00
committed by GitHub
parent 5b14cc6f0b
commit 648d9e253c
102 changed files with 1464 additions and 1329 deletions

View File

@@ -20,11 +20,11 @@ import (
"github.com/gogs/git-module"
"gogs.io/gogs/internal/conf"
"gogs.io/gogs/internal/db"
"gogs.io/gogs/internal/db/errors"
"gogs.io/gogs/internal/httplib"
"gogs.io/gogs/internal/mailer"
"gogs.io/gogs/internal/setting"
"gogs.io/gogs/internal/template"
)
@@ -141,7 +141,7 @@ func runHookPreReceive(c *cli.Context) error {
}
var hookCmd *exec.Cmd
if setting.IsWindows {
if conf.IsWindowsRuntime() {
hookCmd = exec.Command("bash.exe", "custom_hooks/pre-receive")
} else {
hookCmd = exec.Command(customHooksPath)
@@ -175,7 +175,7 @@ func runHookUpdate(c *cli.Context) error {
}
var hookCmd *exec.Cmd
if setting.IsWindows {
if conf.IsWindowsRuntime() {
hookCmd = exec.Command("bash.exe", append([]string{"custom_hooks/update"}, args...)...)
} else {
hookCmd = exec.Command(customHooksPath, args...)
@@ -198,7 +198,7 @@ func runHookPostReceive(c *cli.Context) error {
// Post-receive hook does more than just gather Git information,
// so we need to setup additional services for email notifications.
setting.NewPostReceiveHookServices()
conf.NewPostReceiveHookServices()
mailer.NewContext()
isWiki := strings.Contains(os.Getenv(db.ENV_REPO_CUSTOM_HOOKS_PATH), ".wiki.git/")
@@ -233,7 +233,7 @@ func runHookPostReceive(c *cli.Context) error {
}
// Ask for running deliver hook and test pull request tasks
reqURL := setting.LocalURL + options.RepoUserName + "/" + options.RepoName + "/tasks/trigger?branch=" +
reqURL := conf.Server.LocalRootURL + options.RepoUserName + "/" + options.RepoName + "/tasks/trigger?branch=" +
template.EscapePound(strings.TrimPrefix(options.RefFullName, git.BRANCH_PREFIX)) +
"&secret=" + os.Getenv(db.ENV_REPO_OWNER_SALT_MD5) +
"&pusher=" + os.Getenv(db.ENV_AUTH_USER_ID)
@@ -258,7 +258,7 @@ func runHookPostReceive(c *cli.Context) error {
}
var hookCmd *exec.Cmd
if setting.IsWindows {
if conf.IsWindowsRuntime() {
hookCmd = exec.Command("bash.exe", "custom_hooks/post-receive")
} else {
hookCmd = exec.Command(customHooksPath)