summaryrefslogtreecommitdiff
path: root/app/models/application_setting.rb
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-02-14 18:00:37 +0800
committerLin Jen-Shin <godfat@godfat.org>2017-02-15 15:31:51 +0800
commitd2d30cff552e08c4b7ec2b5e23acced8eb29cbcb (patch)
tree7d7c8055b57aee85426cd150c6f42dc1b7c0a675 /app/models/application_setting.rb
parent1452729304393978ec93b712130dff6687db01b9 (diff)
downloadgitlab-ce-d2d30cff552e08c4b7ec2b5e23acced8eb29cbcb.tar.gz
Initial implementation for default artifacts expiration
TODO: Add tests and screenshots
Diffstat (limited to 'app/models/application_setting.rb')
-rw-r--r--app/models/application_setting.rb19
1 files changed, 17 insertions, 2 deletions
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb
index 74b358d8c40..a871dc9e5b9 100644
--- a/app/models/application_setting.rb
+++ b/app/models/application_setting.rb
@@ -76,6 +76,14 @@ class ApplicationSetting < ActiveRecord::Base
presence: true,
numericality: { only_integer: true, greater_than: 0 }
+ validates :max_artifacts_size,
+ presence: true,
+ numericality: { only_integer: true, greater_than: 0 }
+
+ validates :default_artifacts_expiration,
+ presence: true,
+ numericality: { only_integer: true, greater_than_or_equal_to: 0 }
+
validates :container_registry_token_expire_delay,
presence: true,
numericality: { only_integer: true, greater_than: 0 }
@@ -168,6 +176,7 @@ class ApplicationSetting < ActiveRecord::Base
after_sign_up_text: nil,
akismet_enabled: false,
container_registry_token_expire_delay: 5,
+ default_artifacts_expiration: 30,
default_branch_protection: Settings.gitlab['default_branch_protection'],
default_project_visibility: Settings.gitlab.default_projects_features['visibility_level'],
default_projects_limit: Settings.gitlab['default_projects_limit'],
@@ -201,9 +210,9 @@ class ApplicationSetting < ActiveRecord::Base
sign_in_text: nil,
signin_enabled: Settings.gitlab['signin_enabled'],
signup_enabled: Settings.gitlab['signup_enabled'],
+ terminal_max_session_time: 0,
two_factor_grace_period: 48,
- user_default_external: false,
- terminal_max_session_time: 0
+ user_default_external: false
}
end
@@ -282,6 +291,12 @@ class ApplicationSetting < ActiveRecord::Base
sidekiq_throttling_enabled
end
+ def default_artifacts_expire_in
+ if default_artifacts_expiration.nonzero?
+ "#{default_artifacts_expiration} days"
+ end
+ end
+
private
def check_repository_storages