aboutsummaryrefslogtreecommitdiffstats
path: root/modules/setting
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2022-01-20 18:46:10 +0100
committerGitHub <noreply@github.com>2022-01-20 18:46:10 +0100
commit54e9ee37a7a301dbe74d46fd3c87712e6120e9bf (patch)
tree1be12fb072625c1b896b9d72f7912b018aad502b /modules/setting
parent1d98d205f5825f40110e6628b61a97c91ac7f72d (diff)
downloadgitea-54e9ee37a7a301dbe74d46fd3c87712e6120e9bf.tar.gz
gitea-54e9ee37a7a301dbe74d46fd3c87712e6120e9bf.zip
format with gofumpt (#18184)
* gofumpt -w -l . * gofumpt -w -l -extra . * Add linter * manual fix * change make fmt
Diffstat (limited to 'modules/setting')
-rw-r--r--modules/setting/attachment.go34
-rw-r--r--modules/setting/cache.go50
-rw-r--r--modules/setting/cors.go32
-rw-r--r--modules/setting/cron_test.go2
-rw-r--r--modules/setting/database.go2
-rw-r--r--modules/setting/git.go110
-rw-r--r--modules/setting/indexer.go60
-rw-r--r--modules/setting/indexer_test.go1
-rw-r--r--modules/setting/lfs.go2
-rw-r--r--modules/setting/log.go10
-rw-r--r--modules/setting/mailer.go6
-rw-r--r--modules/setting/markup.go2
-rw-r--r--modules/setting/migrations.go26
-rw-r--r--modules/setting/mime_type_map.go18
-rw-r--r--modules/setting/mirror.go30
-rw-r--r--modules/setting/proxy.go24
-rw-r--r--modules/setting/session.go52
-rw-r--r--modules/setting/setting.go11
-rw-r--r--modules/setting/webhook.go40
19 files changed, 243 insertions, 269 deletions
diff --git a/modules/setting/attachment.go b/modules/setting/attachment.go
index 409c2b87e5..c3c2c3fafd 100644
--- a/modules/setting/attachment.go
+++ b/modules/setting/attachment.go
@@ -4,24 +4,22 @@
package setting
-var (
- // Attachment settings
- Attachment = struct {
- Storage
- AllowedTypes string
- MaxSize int64
- MaxFiles int
- Enabled bool
- }{
- Storage: Storage{
- ServeDirect: false,
- },
- AllowedTypes: "image/jpeg,image/png,application/zip,application/gzip",
- MaxSize: 4,
- MaxFiles: 5,
- Enabled: true,
- }
-)
+// Attachment settings
+var Attachment = struct {
+ Storage
+ AllowedTypes string
+ MaxSize int64
+ MaxFiles int
+ Enabled bool
+}{
+ Storage: Storage{
+ ServeDirect: false,
+ },
+ AllowedTypes: "image/jpeg,image/png,application/zip,application/gzip",
+ MaxSize: 4,
+ MaxFiles: 5,
+ Enabled: true,
+}
func newAttachmentService() {
sec := Cfg.Section("attachment")
diff --git a/modules/setting/cache.go b/modules/setting/cache.go
index 2bfe2318f5..9a44965124 100644
--- a/modules/setting/cache.go
+++ b/modules/setting/cache.go
@@ -20,34 +20,32 @@ type Cache struct {
TTL time.Duration `ini:"ITEM_TTL"`
}
-var (
- // CacheService the global cache
- CacheService = struct {
- Cache `ini:"cache"`
+// CacheService the global cache
+var CacheService = struct {
+ Cache `ini:"cache"`
- LastCommit struct {
- Enabled bool
- TTL time.Duration `ini:"ITEM_TTL"`
- CommitsCount int64
- } `ini:"cache.last_commit"`
+ LastCommit struct {
+ Enabled bool
+ TTL time.Duration `ini:"ITEM_TTL"`
+ CommitsCount int64
+ } `ini:"cache.last_commit"`
+}{
+ Cache: Cache{
+ Enabled: true,
+ Adapter: "memory",
+ Interval: 60,
+ TTL: 16 * time.Hour,
+ },
+ LastCommit: struct {
+ Enabled bool
+ TTL time.Duration `ini:"ITEM_TTL"`
+ CommitsCount int64
}{
- Cache: Cache{
- Enabled: true,
- Adapter: "memory",
- Interval: 60,
- TTL: 16 * time.Hour,
- },
- LastCommit: struct {
- Enabled bool
- TTL time.Duration `ini:"ITEM_TTL"`
- CommitsCount int64
- }{
- Enabled: true,
- TTL: 8760 * time.Hour,
- CommitsCount: 1000,
- },
- }
-)
+ Enabled: true,
+ TTL: 8760 * time.Hour,
+ CommitsCount: 1000,
+ },
+}
// MemcacheMaxTTL represents the maximum memcache TTL
const MemcacheMaxTTL = 30 * 24 * time.Hour
diff --git a/modules/setting/cors.go b/modules/setting/cors.go
index 4c7997d584..a843194ff9 100644
--- a/modules/setting/cors.go
+++ b/modules/setting/cors.go
@@ -10,23 +10,21 @@ import (
"code.gitea.io/gitea/modules/log"
)
-var (
- // CORSConfig defines CORS settings
- CORSConfig = struct {
- Enabled bool
- Scheme string
- AllowDomain []string
- AllowSubdomain bool
- Methods []string
- MaxAge time.Duration
- AllowCredentials bool
- XFrameOptions string
- }{
- Enabled: false,
- MaxAge: 10 * time.Minute,
- XFrameOptions: "SAMEORIGIN",
- }
-)
+// CORSConfig defines CORS settings
+var CORSConfig = struct {
+ Enabled bool
+ Scheme string
+ AllowDomain []string
+ AllowSubdomain bool
+ Methods []string
+ MaxAge time.Duration
+ AllowCredentials bool
+ XFrameOptions string
+}{
+ Enabled: false,
+ MaxAge: 10 * time.Minute,
+ XFrameOptions: "SAMEORIGIN",
+}
func newCORSService() {
sec := Cfg.Section("cors")
diff --git a/modules/setting/cron_test.go b/modules/setting/cron_test.go
index 8670a92bac..cb397d81c4 100644
--- a/modules/setting/cron_test.go
+++ b/modules/setting/cron_test.go
@@ -12,7 +12,6 @@ import (
)
func Test_GetCronSettings(t *testing.T) {
-
type BaseStruct struct {
Base bool
Second string
@@ -43,5 +42,4 @@ Extend = true
assert.True(t, extended.Base)
assert.EqualValues(t, extended.Second, "white rabbit")
assert.True(t, extended.Extend)
-
}
diff --git a/modules/setting/database.go b/modules/setting/database.go
index 8db1cd13eb..5be2d8deea 100644
--- a/modules/setting/database.go
+++ b/modules/setting/database.go
@@ -102,7 +102,7 @@ func InitDBConfig() {
// DBConnStr returns database connection string
func DBConnStr() (string, error) {
connStr := ""
- var Param = "?"
+ Param := "?"
if strings.Contains(Database.Name, Param) {
Param = "&"
}
diff --git a/modules/setting/git.go b/modules/setting/git.go
index 4cf7e722e7..9b2698f01e 100644
--- a/modules/setting/git.go
+++ b/modules/setting/git.go
@@ -10,63 +10,61 @@ import (
"code.gitea.io/gitea/modules/log"
)
-var (
- // Git settings
- Git = struct {
- Path string
- DisableDiffHighlight bool
- MaxGitDiffLines int
- MaxGitDiffLineCharacters int
- MaxGitDiffFiles int
- CommitsRangeSize int // CommitsRangeSize the default commits range size
- BranchesRangeSize int // BranchesRangeSize the default branches range size
- VerbosePush bool
- VerbosePushDelay time.Duration
- GCArgs []string `ini:"GC_ARGS" delim:" "`
- EnableAutoGitWireProtocol bool
- PullRequestPushMessage bool
- LargeObjectThreshold int64
- DisableCoreProtectNTFS bool
- DisablePartialClone bool
- Timeout struct {
- Default int
- Migrate int
- Mirror int
- Clone int
- Pull int
- GC int `ini:"GC"`
- } `ini:"git.timeout"`
+// Git settings
+var Git = struct {
+ Path string
+ DisableDiffHighlight bool
+ MaxGitDiffLines int
+ MaxGitDiffLineCharacters int
+ MaxGitDiffFiles int
+ CommitsRangeSize int // CommitsRangeSize the default commits range size
+ BranchesRangeSize int // BranchesRangeSize the default branches range size
+ VerbosePush bool
+ VerbosePushDelay time.Duration
+ GCArgs []string `ini:"GC_ARGS" delim:" "`
+ EnableAutoGitWireProtocol bool
+ PullRequestPushMessage bool
+ LargeObjectThreshold int64
+ DisableCoreProtectNTFS bool
+ DisablePartialClone bool
+ Timeout struct {
+ Default int
+ Migrate int
+ Mirror int
+ Clone int
+ Pull int
+ GC int `ini:"GC"`
+ } `ini:"git.timeout"`
+}{
+ DisableDiffHighlight: false,
+ MaxGitDiffLines: 1000,
+ MaxGitDiffLineCharacters: 5000,
+ MaxGitDiffFiles: 100,
+ CommitsRangeSize: 50,
+ BranchesRangeSize: 20,
+ VerbosePush: true,
+ VerbosePushDelay: 5 * time.Second,
+ GCArgs: []string{},
+ EnableAutoGitWireProtocol: true,
+ PullRequestPushMessage: true,
+ LargeObjectThreshold: 1024 * 1024,
+ DisablePartialClone: false,
+ Timeout: struct {
+ Default int
+ Migrate int
+ Mirror int
+ Clone int
+ Pull int
+ GC int `ini:"GC"`
}{
- DisableDiffHighlight: false,
- MaxGitDiffLines: 1000,
- MaxGitDiffLineCharacters: 5000,
- MaxGitDiffFiles: 100,
- CommitsRangeSize: 50,
- BranchesRangeSize: 20,
- VerbosePush: true,
- VerbosePushDelay: 5 * time.Second,
- GCArgs: []string{},
- EnableAutoGitWireProtocol: true,
- PullRequestPushMessage: true,
- LargeObjectThreshold: 1024 * 1024,
- DisablePartialClone: false,
- Timeout: struct {
- Default int
- Migrate int
- Mirror int
- Clone int
- Pull int
- GC int `ini:"GC"`
- }{
- Default: 360,
- Migrate: 600,
- Mirror: 300,
- Clone: 300,
- Pull: 300,
- GC: 60,
- },
- }
-)
+ Default: 360,
+ Migrate: 600,
+ Mirror: 300,
+ Clone: 300,
+ Pull: 300,
+ GC: 60,
+ },
+}
func newGit() {
if err := Cfg.Section("git").MapTo(&Git); err != nil {
diff --git a/modules/setting/indexer.go b/modules/setting/indexer.go
index f103a7464b..46d4027d14 100644
--- a/modules/setting/indexer.go
+++ b/modules/setting/indexer.go
@@ -14,39 +14,37 @@ import (
"github.com/gobwas/glob"
)
-var (
- // Indexer settings
- Indexer = struct {
- IssueType string
- IssuePath string
- IssueConnStr string
- IssueIndexerName string
- StartupTimeout time.Duration
+// Indexer settings
+var Indexer = struct {
+ IssueType string
+ IssuePath string
+ IssueConnStr string
+ IssueIndexerName string
+ StartupTimeout time.Duration
- RepoIndexerEnabled bool
- RepoType string
- RepoPath string
- RepoConnStr string
- RepoIndexerName string
- MaxIndexerFileSize int64
- IncludePatterns []glob.Glob
- ExcludePatterns []glob.Glob
- ExcludeVendored bool
- }{
- IssueType: "bleve",
- IssuePath: "indexers/issues.bleve",
- IssueConnStr: "",
- IssueIndexerName: "gitea_issues",
+ RepoIndexerEnabled bool
+ RepoType string
+ RepoPath string
+ RepoConnStr string
+ RepoIndexerName string
+ MaxIndexerFileSize int64
+ IncludePatterns []glob.Glob
+ ExcludePatterns []glob.Glob
+ ExcludeVendored bool
+}{
+ IssueType: "bleve",
+ IssuePath: "indexers/issues.bleve",
+ IssueConnStr: "",
+ IssueIndexerName: "gitea_issues",
- RepoIndexerEnabled: false,
- RepoType: "bleve",
- RepoPath: "indexers/repos.bleve",
- RepoConnStr: "",
- RepoIndexerName: "gitea_codes",
- MaxIndexerFileSize: 1024 * 1024,
- ExcludeVendored: true,
- }
-)
+ RepoIndexerEnabled: false,
+ RepoType: "bleve",
+ RepoPath: "indexers/repos.bleve",
+ RepoConnStr: "",
+ RepoIndexerName: "gitea_codes",
+ MaxIndexerFileSize: 1024 * 1024,
+ ExcludeVendored: true,
+}
func newIndexerService() {
sec := Cfg.Section("indexer")
diff --git a/modules/setting/indexer_test.go b/modules/setting/indexer_test.go
index ed631747dc..0ff1d814ab 100644
--- a/modules/setting/indexer_test.go
+++ b/modules/setting/indexer_test.go
@@ -16,7 +16,6 @@ type indexerMatchList struct {
}
func Test_newIndexerGlobSettings(t *testing.T) {
-
checkGlobMatch(t, "", []indexerMatchList{})
checkGlobMatch(t, " ", []indexerMatchList{})
checkGlobMatch(t, "data, */data, */data/*, **/data/*, **/data/**", []indexerMatchList{
diff --git a/modules/setting/lfs.go b/modules/setting/lfs.go
index 7065ce6383..3179a67ce7 100644
--- a/modules/setting/lfs.go
+++ b/modules/setting/lfs.go
@@ -36,7 +36,7 @@ func newLFSService() {
storageType := lfsSec.Key("STORAGE_TYPE").MustString("")
// Specifically default PATH to LFS_CONTENT_PATH
- //FIXME: DEPRECATED to be removed in v1.18.0
+ // FIXME: DEPRECATED to be removed in v1.18.0
deprecatedSetting("server", "LFS_CONTENT_PATH", "lfs", "PATH")
lfsSec.Key("PATH").MustString(
sec.Key("LFS_CONTENT_PATH").String())
diff --git a/modules/setting/log.go b/modules/setting/log.go
index a53b431196..e666e2a027 100644
--- a/modules/setting/log.go
+++ b/modules/setting/log.go
@@ -19,9 +19,11 @@ import (
ini "gopkg.in/ini.v1"
)
-var filenameSuffix = ""
-var descriptionLock = sync.RWMutex{}
-var logDescriptions = make(map[string]*LogDescription)
+var (
+ filenameSuffix = ""
+ descriptionLock = sync.RWMutex{}
+ logDescriptions = make(map[string]*LogDescription)
+)
// GetLogDescriptions returns a race safe set of descriptions
func GetLogDescriptions() map[string]*LogDescription {
@@ -86,7 +88,7 @@ func RemoveSubLogDescription(key, name string) bool {
type defaultLogOptions struct {
levelName string // LogLevel
flags string
- filename string //path.Join(LogRootPath, "gitea.log")
+ filename string // path.Join(LogRootPath, "gitea.log")
bufferLength int64
disableConsole bool
}
diff --git a/modules/setting/mailer.go b/modules/setting/mailer.go
index 5da520171e..8a26f8b0c4 100644
--- a/modules/setting/mailer.go
+++ b/modules/setting/mailer.go
@@ -43,10 +43,8 @@ type Mailer struct {
SendmailConvertCRLF bool
}
-var (
- // MailService the global mailer
- MailService *Mailer
-)
+// MailService the global mailer
+var MailService *Mailer
func newMailService() {
sec := Cfg.Section("mailer")
diff --git a/modules/setting/markup.go b/modules/setting/markup.go
index 0bf6797712..09b86b9b1a 100644
--- a/modules/setting/markup.go
+++ b/modules/setting/markup.go
@@ -123,7 +123,7 @@ func newMarkupRenderer(name string, sec *ini.Section) {
extensionReg := regexp.MustCompile(`\.\w`)
extensions := sec.Key("FILE_EXTENSIONS").Strings(",")
- var exts = make([]string, 0, len(extensions))
+ exts := make([]string, 0, len(extensions))
for _, extension := range extensions {
if !extensionReg.MatchString(extension) {
log.Warn(sec.Name() + " file extension " + extension + " is invalid. Extension ignored")
diff --git a/modules/setting/migrations.go b/modules/setting/migrations.go
index 34d9037275..4b10f3dc6e 100644
--- a/modules/setting/migrations.go
+++ b/modules/setting/migrations.go
@@ -4,20 +4,18 @@
package setting
-var (
- // Migrations settings
- Migrations = struct {
- MaxAttempts int
- RetryBackoff int
- AllowedDomains string
- BlockedDomains string
- AllowLocalNetworks bool
- SkipTLSVerify bool
- }{
- MaxAttempts: 3,
- RetryBackoff: 3,
- }
-)
+// Migrations settings
+var Migrations = struct {
+ MaxAttempts int
+ RetryBackoff int
+ AllowedDomains string
+ BlockedDomains string
+ AllowLocalNetworks bool
+ SkipTLSVerify bool
+}{
+ MaxAttempts: 3,
+ RetryBackoff: 3,
+}
func newMigrationsService() {
sec := Cfg.Section("migrations")
diff --git a/modules/setting/mime_type_map.go b/modules/setting/mime_type_map.go
index 5c1fc7f71a..8e5b864e24 100644
--- a/modules/setting/mime_type_map.go
+++ b/modules/setting/mime_type_map.go
@@ -6,16 +6,14 @@ package setting
import "strings"
-var (
- // MimeTypeMap defines custom mime type mapping settings
- MimeTypeMap = struct {
- Enabled bool
- Map map[string]string
- }{
- Enabled: false,
- Map: map[string]string{},
- }
-)
+// MimeTypeMap defines custom mime type mapping settings
+var MimeTypeMap = struct {
+ Enabled bool
+ Map map[string]string
+}{
+ Enabled: false,
+ Map: map[string]string{},
+}
func newMimeTypeMap() {
sec := Cfg.Section("repository.mimetype_mapping")
diff --git a/modules/setting/mirror.go b/modules/setting/mirror.go
index e49393e39c..2bd0322d06 100644
--- a/modules/setting/mirror.go
+++ b/modules/setting/mirror.go
@@ -10,22 +10,20 @@ import (
"code.gitea.io/gitea/modules/log"
)
-var (
- // Mirror settings
- Mirror = struct {
- Enabled bool
- DisableNewPull bool
- DisableNewPush bool
- DefaultInterval time.Duration
- MinInterval time.Duration
- }{
- Enabled: true,
- DisableNewPull: false,
- DisableNewPush: false,
- MinInterval: 10 * time.Minute,
- DefaultInterval: 8 * time.Hour,
- }
-)
+// Mirror settings
+var Mirror = struct {
+ Enabled bool
+ DisableNewPull bool
+ DisableNewPush bool
+ DefaultInterval time.Duration
+ MinInterval time.Duration
+}{
+ Enabled: true,
+ DisableNewPull: false,
+ DisableNewPush: false,
+ MinInterval: 10 * time.Minute,
+ DefaultInterval: 8 * time.Hour,
+}
func newMirror() {
// Handle old configuration through `[repository]` `DISABLE_MIRRORS`
diff --git a/modules/setting/proxy.go b/modules/setting/proxy.go
index b99237a398..53fb0066d9 100644
--- a/modules/setting/proxy.go
+++ b/modules/setting/proxy.go
@@ -10,19 +10,17 @@ import (
"code.gitea.io/gitea/modules/log"
)
-var (
- // Proxy settings
- Proxy = struct {
- Enabled bool
- ProxyURL string
- ProxyURLFixed *url.URL
- ProxyHosts []string
- }{
- Enabled: false,
- ProxyURL: "",
- ProxyHosts: []string{},
- }
-)
+// Proxy settings
+var Proxy = struct {
+ Enabled bool
+ ProxyURL string
+ ProxyURLFixed *url.URL
+ ProxyHosts []string
+}{
+ Enabled: false,
+ ProxyURL: "",
+ ProxyHosts: []string{},
+}
func newProxyService() {
sec := Cfg.Section("proxy")
diff --git a/modules/setting/session.go b/modules/setting/session.go
index 9e6193e826..62ca1d82e8 100644
--- a/modules/setting/session.go
+++ b/modules/setting/session.go
@@ -14,33 +14,31 @@ import (
"code.gitea.io/gitea/modules/log"
)
-var (
- // SessionConfig defines Session settings
- SessionConfig = struct {
- Provider string
- // Provider configuration, it's corresponding to provider.
- ProviderConfig string
- // Cookie name to save session ID. Default is "MacaronSession".
- CookieName string
- // Cookie path to store. Default is "/".
- CookiePath string
- // GC interval time in seconds. Default is 3600.
- Gclifetime int64
- // Max life time in seconds. Default is whatever GC interval time is.
- Maxlifetime int64
- // Use HTTPS only. Default is false.
- Secure bool
- // Cookie domain name. Default is empty.
- Domain string
- // SameSite declares if your cookie should be restricted to a first-party or same-site context. Valid strings are "none", "lax", "strict". Default is "lax"
- SameSite http.SameSite
- }{
- CookieName: "i_like_gitea",
- Gclifetime: 86400,
- Maxlifetime: 86400,
- SameSite: http.SameSiteLaxMode,
- }
-)
+// SessionConfig defines Session settings
+var SessionConfig = struct {
+ Provider string
+ // Provider configuration, it's corresponding to provider.
+ ProviderConfig string
+ // Cookie name to save session ID. Default is "MacaronSession".
+ CookieName string
+ // Cookie path to store. Default is "/".
+ CookiePath string
+ // GC interval time in seconds. Default is 3600.
+ Gclifetime int64
+ // Max life time in seconds. Default is whatever GC interval time is.
+ Maxlifetime int64
+ // Use HTTPS only. Default is false.
+ Secure bool
+ // Cookie domain name. Default is empty.
+ Domain string
+ // SameSite declares if your cookie should be restricted to a first-party or same-site context. Valid strings are "none", "lax", "strict". Default is "lax"
+ SameSite http.SameSite
+}{
+ CookieName: "i_like_gitea",
+ Gclifetime: 86400,
+ Maxlifetime: 86400,
+ SameSite: http.SameSiteLaxMode,
+}
func newSessionService() {
sec := Cfg.Section("session")
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index 3c8e009daa..5b8683f578 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -644,7 +644,7 @@ func loadFromConf(allowEmpty bool, extraConfig string) {
}
UnixSocketPermissionRaw := sec.Key("UNIX_SOCKET_PERMISSION").MustString("666")
UnixSocketPermissionParsed, err := strconv.ParseUint(UnixSocketPermissionRaw, 8, 32)
- if err != nil || UnixSocketPermissionParsed > 0777 {
+ if err != nil || UnixSocketPermissionParsed > 0o777 {
log.Fatal("Failed to parse unixSocketPermission: %s", UnixSocketPermissionRaw)
}
@@ -800,16 +800,16 @@ func loadFromConf(allowEmpty bool, extraConfig string) {
SSH.AuthorizedPrincipalsAllow, SSH.AuthorizedPrincipalsEnabled = parseAuthorizedPrincipalsAllow(sec.Key("SSH_AUTHORIZED_PRINCIPALS_ALLOW").Strings(","))
if !SSH.Disabled && !SSH.StartBuiltinServer {
- if err := os.MkdirAll(SSH.RootPath, 0700); err != nil {
+ if err := os.MkdirAll(SSH.RootPath, 0o700); err != nil {
log.Fatal("Failed to create '%s': %v", SSH.RootPath, err)
- } else if err = os.MkdirAll(SSH.KeyTestPath, 0644); err != nil {
+ } else if err = os.MkdirAll(SSH.KeyTestPath, 0o644); err != nil {
log.Fatal("Failed to create '%s': %v", SSH.KeyTestPath, err)
}
if len(trustedUserCaKeys) > 0 && SSH.AuthorizedPrincipalsEnabled {
fname := sec.Key("SSH_TRUSTED_USER_CA_KEYS_FILENAME").MustString(filepath.Join(SSH.RootPath, "gitea-trusted-user-ca-keys.pem"))
if err := os.WriteFile(fname,
- []byte(strings.Join(trustedUserCaKeys, "\n")), 0600); err != nil {
+ []byte(strings.Join(trustedUserCaKeys, "\n")), 0o600); err != nil {
log.Fatal("Failed to create '%s': %v", fname, err)
}
}
@@ -1080,7 +1080,7 @@ func loadInternalToken(sec *ini.Section) string {
}
switch tempURI.Scheme {
case "file":
- fp, err := os.OpenFile(tempURI.RequestURI(), os.O_RDWR, 0600)
+ fp, err := os.OpenFile(tempURI.RequestURI(), os.O_RDWR, 0o600)
if err != nil {
log.Fatal("Failed to open InternalTokenURI (%s): %v", uri, err)
}
@@ -1173,7 +1173,6 @@ func MakeManifestData(appName, appURL, absoluteAssetURL string) []byte {
},
},
})
-
if err != nil {
log.Error("unable to marshal manifest JSON. Error: %v", err)
return make([]byte, 0)
diff --git a/modules/setting/webhook.go b/modules/setting/webhook.go
index 6284f397b1..b576f9573b 100644
--- a/modules/setting/webhook.go
+++ b/modules/setting/webhook.go
@@ -10,27 +10,25 @@ import (
"code.gitea.io/gitea/modules/log"
)
-var (
- // Webhook settings
- Webhook = struct {
- QueueLength int
- DeliverTimeout int
- SkipTLSVerify bool
- AllowedHostList string
- Types []string
- PagingNum int
- ProxyURL string
- ProxyURLFixed *url.URL
- ProxyHosts []string
- }{
- QueueLength: 1000,
- DeliverTimeout: 5,
- SkipTLSVerify: false,
- PagingNum: 10,
- ProxyURL: "",
- ProxyHosts: []string{},
- }
-)
+// Webhook settings
+var Webhook = struct {
+ QueueLength int
+ DeliverTimeout int
+ SkipTLSVerify bool
+ AllowedHostList string
+ Types []string
+ PagingNum int
+ ProxyURL string
+ ProxyURLFixed *url.URL
+ ProxyHosts []string
+}{
+ QueueLength: 1000,
+ DeliverTimeout: 5,
+ SkipTLSVerify: false,
+ PagingNum: 10,
+ ProxyURL: "",
+ ProxyHosts: []string{},
+}
func newWebhookService() {
sec := Cfg.Section("webhook")