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

@@ -8,10 +8,10 @@ import (
"github.com/unknwon/com"
log "unknwon.dev/clog/v2"
"gogs.io/gogs/internal/conf"
"gogs.io/gogs/internal/context"
"gogs.io/gogs/internal/db"
"gogs.io/gogs/internal/db/errors"
"gogs.io/gogs/internal/setting"
)
const (
@@ -87,7 +87,7 @@ func MembersAction(c *context.Context) {
if c.Params(":action") != "leave" {
c.Redirect(c.Org.OrgLink + "/members")
} else {
c.Redirect(setting.AppSubURL + "/")
c.Redirect(conf.Server.Subpath + "/")
}
}

View File

@@ -7,10 +7,10 @@ package org
import (
log "unknwon.dev/clog/v2"
"gogs.io/gogs/internal/conf"
"gogs.io/gogs/internal/context"
"gogs.io/gogs/internal/db"
"gogs.io/gogs/internal/form"
"gogs.io/gogs/internal/setting"
)
const (
@@ -52,5 +52,5 @@ func CreatePost(c *context.Context, f form.CreateOrg) {
}
log.Trace("Organization created: %s", org.Name)
c.Redirect(setting.AppSubURL + "/org/" + f.OrgName + "/dashboard")
c.Redirect(conf.Server.Subpath + "/org/" + f.OrgName + "/dashboard")
}

View File

@@ -9,12 +9,12 @@ import (
log "unknwon.dev/clog/v2"
"gogs.io/gogs/internal/conf"
"gogs.io/gogs/internal/context"
"gogs.io/gogs/internal/db"
"gogs.io/gogs/internal/db/errors"
"gogs.io/gogs/internal/form"
"gogs.io/gogs/internal/route/user"
"gogs.io/gogs/internal/setting"
)
const (
@@ -63,7 +63,7 @@ func SettingsPost(c *context.Context, f form.UpdateOrgSetting) {
return
}
// reset c.org.OrgLink with new name
c.Org.OrgLink = setting.AppSubURL + "/org/" + f.Name
c.Org.OrgLink = conf.Server.Subpath + "/org/" + f.Name
log.Trace("Organization name changed: %s -> %s", org.Name, f.Name)
}
// In case it's just a case change.
@@ -130,7 +130,7 @@ func SettingsDelete(c *context.Context) {
}
} else {
log.Trace("Organization deleted: %s", org.Name)
c.Redirect(setting.AppSubURL + "/")
c.Redirect(conf.Server.Subpath + "/")
}
return
}
@@ -143,7 +143,7 @@ func Webhooks(c *context.Context) {
c.Data["PageIsSettingsHooks"] = true
c.Data["BaseLink"] = c.Org.OrgLink
c.Data["Description"] = c.Tr("org.settings.hooks_desc")
c.Data["Types"] = setting.Webhook.Types
c.Data["Types"] = conf.Webhook.Types
ws, err := db.GetWebhooksByOrgID(c.Org.Organization.ID)
if err != nil {