summaryrefslogtreecommitdiffstats
path: root/modules/setting/cron.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-03-16 11:12:44 +0800
committerGitHub <noreply@github.com>2019-03-16 11:12:44 +0800
commit379289639e44f8fbb1368c4f2a324f52bcb70e7f (patch)
treebbe0951debfed8f292e8abd1ce1bb6a15072a7e1 /modules/setting/cron.go
parentfaf446b37257c84a038004a3655e49bda1f51a0d (diff)
downloadgitea-379289639e44f8fbb1368c4f2a324f52bcb70e7f.tar.gz
gitea-379289639e44f8fbb1368c4f2a324f52bcb70e7f.zip
split setting.go to multiple files (#6154)
* split setting.go to multiple files * fix lint
Diffstat (limited to 'modules/setting/cron.go')
-rw-r--r--modules/setting/cron.go124
1 files changed, 124 insertions, 0 deletions
diff --git a/modules/setting/cron.go b/modules/setting/cron.go
new file mode 100644
index 0000000000..48298b453c
--- /dev/null
+++ b/modules/setting/cron.go
@@ -0,0 +1,124 @@
+// Copyright 2019 The Gitea Authors. All rights reserved.
+// Use of this source code is governed by a MIT-style
+// license that can be found in the LICENSE file.
+
+package setting
+
+import (
+ "time"
+
+ "code.gitea.io/gitea/modules/log"
+)
+
+var (
+
+ // Cron tasks
+ Cron = struct {
+ UpdateMirror struct {
+ Enabled bool
+ RunAtStart bool
+ Schedule string
+ } `ini:"cron.update_mirrors"`
+ RepoHealthCheck struct {
+ Enabled bool
+ RunAtStart bool
+ Schedule string
+ Timeout time.Duration
+ Args []string `delim:" "`
+ } `ini:"cron.repo_health_check"`
+ CheckRepoStats struct {
+ Enabled bool
+ RunAtStart bool
+ Schedule string
+ } `ini:"cron.check_repo_stats"`
+ ArchiveCleanup struct {
+ Enabled bool
+ RunAtStart bool
+ Schedule string
+ OlderThan time.Duration
+ } `ini:"cron.archive_cleanup"`
+ SyncExternalUsers struct {
+ Enabled bool
+ RunAtStart bool
+ Schedule string
+ UpdateExisting bool
+ } `ini:"cron.sync_external_users"`
+ DeletedBranchesCleanup struct {
+ Enabled bool
+ RunAtStart bool
+ Schedule string
+ OlderThan time.Duration
+ } `ini:"cron.deleted_branches_cleanup"`
+ }{
+ UpdateMirror: struct {
+ Enabled bool
+ RunAtStart bool
+ Schedule string
+ }{
+ Enabled: true,
+ RunAtStart: false,
+ Schedule: "@every 10m",
+ },
+ RepoHealthCheck: struct {
+ Enabled bool
+ RunAtStart bool
+ Schedule string
+ Timeout time.Duration
+ Args []string `delim:" "`
+ }{
+ Enabled: true,
+ RunAtStart: false,
+ Schedule: "@every 24h",
+ Timeout: 60 * time.Second,
+ Args: []string{},
+ },
+ CheckRepoStats: struct {
+ Enabled bool
+ RunAtStart bool
+ Schedule string
+ }{
+ Enabled: true,
+ RunAtStart: true,
+ Schedule: "@every 24h",
+ },
+ ArchiveCleanup: struct {
+ Enabled bool
+ RunAtStart bool
+ Schedule string
+ OlderThan time.Duration
+ }{
+ Enabled: true,
+ RunAtStart: true,
+ Schedule: "@every 24h",
+ OlderThan: 24 * time.Hour,
+ },
+ SyncExternalUsers: struct {
+ Enabled bool
+ RunAtStart bool
+ Schedule string
+ UpdateExisting bool
+ }{
+ Enabled: true,
+ RunAtStart: false,
+ Schedule: "@every 24h",
+ UpdateExisting: true,
+ },
+ DeletedBranchesCleanup: struct {
+ Enabled bool
+ RunAtStart bool
+ Schedule string
+ OlderThan time.Duration
+ }{
+ Enabled: true,
+ RunAtStart: true,
+ Schedule: "@every 24h",
+ OlderThan: 24 * time.Hour,
+ },
+ }
+)
+
+func newCron() {
+ if err := Cfg.Section("cron").MapTo(&Cron); err != nil {
+ log.Fatal(4, "Failed to map Cron settings: %v", err)
+ }
+}