mirror of
https://github.com/gogs/gogs.git
synced 2026-03-06 12:11:00 +01:00
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:
@@ -16,7 +16,7 @@ import (
|
||||
"gogs.io/gogs/internal/db/errors"
|
||||
"gogs.io/gogs/internal/mailer"
|
||||
"gogs.io/gogs/internal/route/api/v1/user"
|
||||
"gogs.io/gogs/internal/setting"
|
||||
"gogs.io/gogs/internal/conf"
|
||||
)
|
||||
|
||||
func parseLoginSource(c *context.APIContext, u *db.User, sourceID int64, loginName string) {
|
||||
@@ -68,7 +68,7 @@ func CreateUser(c *context.APIContext, form api.CreateUserOption) {
|
||||
log.Trace("Account created by admin %q: %s", c.User.Name, u.Name)
|
||||
|
||||
// Send email notification.
|
||||
if form.SendNotify && setting.MailService != nil {
|
||||
if form.SendNotify && conf.MailService != nil {
|
||||
mailer.SendRegisterNotifyMail(c.Context.Context, db.NewMailerUser(u))
|
||||
}
|
||||
|
||||
|
||||
@@ -5,15 +5,15 @@
|
||||
package convert
|
||||
|
||||
import (
|
||||
"gogs.io/gogs/internal/setting"
|
||||
"gogs.io/gogs/internal/conf"
|
||||
)
|
||||
|
||||
// ToCorrectPageSize makes sure page size is in allowed range.
|
||||
func ToCorrectPageSize(size int) int {
|
||||
if size <= 0 {
|
||||
size = 10
|
||||
} else if size > setting.API.MaxResponseItems {
|
||||
size = setting.API.MaxResponseItems
|
||||
} else if size > conf.API.MaxResponseItems {
|
||||
size = conf.API.MaxResponseItems
|
||||
}
|
||||
return size
|
||||
}
|
||||
|
||||
@@ -12,10 +12,10 @@ import (
|
||||
"github.com/gogs/git-module"
|
||||
api "github.com/gogs/go-gogs-client"
|
||||
|
||||
"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"
|
||||
)
|
||||
|
||||
func GetSingleCommit(c *context.APIContext) {
|
||||
@@ -70,12 +70,12 @@ func GetSingleCommit(c *context.APIContext) {
|
||||
|
||||
c.JSONSuccess(&api.Commit{
|
||||
CommitMeta: &api.CommitMeta{
|
||||
URL: setting.AppURL + c.Link[1:],
|
||||
URL: conf.Server.ExternalURL + c.Link[1:],
|
||||
SHA: commit.ID.String(),
|
||||
},
|
||||
HTMLURL: c.Repo.Repository.HTMLURL() + "/commits/" + commit.ID.String(),
|
||||
RepoCommit: &api.RepoCommit{
|
||||
URL: setting.AppURL + c.Link[1:],
|
||||
URL: conf.Server.ExternalURL + c.Link[1:],
|
||||
Author: &api.CommitUser{
|
||||
Name: commit.Author.Name,
|
||||
Email: commit.Author.Email,
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
"gogs.io/gogs/internal/context"
|
||||
"gogs.io/gogs/internal/db"
|
||||
"gogs.io/gogs/internal/db/errors"
|
||||
"gogs.io/gogs/internal/setting"
|
||||
"gogs.io/gogs/internal/conf"
|
||||
)
|
||||
|
||||
func listIssues(c *context.APIContext, opts *db.IssuesOptions) {
|
||||
@@ -40,7 +40,7 @@ func listIssues(c *context.APIContext, opts *db.IssuesOptions) {
|
||||
apiIssues[i] = issues[i].APIFormat()
|
||||
}
|
||||
|
||||
c.SetLinkHeader(int(count), setting.UI.IssuePagingNum)
|
||||
c.SetLinkHeader(int(count), conf.UI.IssuePagingNum)
|
||||
c.JSONSuccess(&apiIssues)
|
||||
}
|
||||
|
||||
|
||||
@@ -10,13 +10,13 @@ import (
|
||||
|
||||
api "github.com/gogs/go-gogs-client"
|
||||
|
||||
"gogs.io/gogs/internal/conf"
|
||||
"gogs.io/gogs/internal/context"
|
||||
"gogs.io/gogs/internal/db"
|
||||
"gogs.io/gogs/internal/setting"
|
||||
)
|
||||
|
||||
func composeDeployKeysAPILink(repoPath string) string {
|
||||
return setting.AppURL + "api/v1/repos/" + repoPath + "/keys/"
|
||||
return conf.Server.ExternalURL + "api/v1/repos/" + repoPath + "/keys/"
|
||||
}
|
||||
|
||||
// https://github.com/gogs/go-gogs-client/wiki/Repositories-Deploy-Keys#list-deploy-keys
|
||||
|
||||
@@ -18,7 +18,7 @@ import (
|
||||
"gogs.io/gogs/internal/db/errors"
|
||||
"gogs.io/gogs/internal/form"
|
||||
"gogs.io/gogs/internal/route/api/v1/convert"
|
||||
"gogs.io/gogs/internal/setting"
|
||||
"gogs.io/gogs/internal/conf"
|
||||
)
|
||||
|
||||
func Search(c *context.APIContext) {
|
||||
@@ -263,7 +263,7 @@ func Migrate(c *context.APIContext, f form.MigrateRepo) {
|
||||
repo, err := db.MigrateRepository(c.User, ctxUser, db.MigrateRepoOptions{
|
||||
Name: f.RepoName,
|
||||
Description: f.Description,
|
||||
IsPrivate: f.Private || setting.Repository.ForcePrivate,
|
||||
IsPrivate: f.Private || conf.Repository.ForcePrivate,
|
||||
IsMirror: f.Mirror,
|
||||
RemoteAddr: remoteAddr,
|
||||
})
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
|
||||
"gogs.io/gogs/internal/context"
|
||||
"gogs.io/gogs/internal/db"
|
||||
"gogs.io/gogs/internal/setting"
|
||||
"gogs.io/gogs/internal/conf"
|
||||
)
|
||||
|
||||
func ListEmails(c *context.APIContext) {
|
||||
@@ -39,7 +39,7 @@ func AddEmail(c *context.APIContext, form api.CreateEmailOption) {
|
||||
emails[i] = &db.EmailAddress{
|
||||
UID: c.User.ID,
|
||||
Email: form.Emails[i],
|
||||
IsActivated: !setting.Service.RegisterEmailConfirm,
|
||||
IsActivated: !conf.Service.RegisterEmailConfirm,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,10 +10,10 @@ import (
|
||||
repo2 "gogs.io/gogs/internal/route/api/v1/repo"
|
||||
"net/http"
|
||||
|
||||
"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"
|
||||
)
|
||||
|
||||
func GetUserByParamsName(c *context.APIContext, name string) *db.User {
|
||||
@@ -31,7 +31,7 @@ func GetUserByParams(c *context.APIContext) *db.User {
|
||||
}
|
||||
|
||||
func composePublicKeysAPILink() string {
|
||||
return setting.AppURL + "api/v1/user/keys/"
|
||||
return conf.Server.ExternalURL + "api/v1/user/keys/"
|
||||
}
|
||||
|
||||
func listPublicKeys(c *context.APIContext, uid int64) {
|
||||
|
||||
Reference in New Issue
Block a user