Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
95280033
Commit
95280033
authored
Jan 14, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move default values to ApplicationSetting::DEFAULTS and use it in CurrentSettings
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
759a2eb8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
76 deletions
+51
-76
app/models/application_setting.rb
app/models/application_setting.rb
+50
-43
lib/gitlab/current_settings.rb
lib/gitlab/current_settings.rb
+1
-33
No files found.
app/models/application_setting.rb
View file @
95280033
...
...
@@ -13,6 +13,55 @@ class ApplicationSetting < ActiveRecord::Base
[
\r\n
] # any number of newline characters
}x
DEFAULTS_CE
=
{
after_sign_up_text:
nil
,
akismet_enabled:
false
,
container_registry_token_expire_delay:
5
,
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'
],
default_snippet_visibility:
Settings
.
gitlab
.
default_projects_features
[
'visibility_level'
],
disabled_oauth_sign_in_sources:
[],
domain_whitelist:
Settings
.
gitlab
[
'domain_whitelist'
],
gravatar_enabled:
Settings
.
gravatar
[
'enabled'
],
help_page_text:
nil
,
housekeeping_bitmaps_enabled:
true
,
housekeeping_enabled:
true
,
housekeeping_full_repack_period:
50
,
housekeeping_gc_period:
200
,
housekeeping_incremental_repack_period:
10
,
import_sources:
Gitlab
::
ImportSources
.
values
,
koding_enabled:
false
,
koding_url:
nil
,
max_artifacts_size:
Settings
.
artifacts
[
'max_size'
],
max_attachment_size:
Settings
.
gitlab
[
'max_attachment_size'
],
plantuml_enabled:
false
,
plantuml_url:
nil
,
recaptcha_enabled:
false
,
repository_checks_enabled:
true
,
repository_storages:
[
'default'
],
require_two_factor_authentication:
false
,
restricted_visibility_levels:
Settings
.
gitlab
[
'restricted_visibility_levels'
],
session_expire_delay:
Settings
.
gitlab
[
'session_expire_delay'
],
send_user_confirmation_email:
false
,
shared_runners_enabled:
Settings
.
gitlab_ci
[
'shared_runners_enabled'
],
shared_runners_text:
nil
,
sidekiq_throttling_enabled:
false
,
sign_in_text:
nil
,
signin_enabled:
Settings
.
gitlab
[
'signin_enabled'
],
signup_enabled:
Settings
.
gitlab
[
'signup_enabled'
],
two_factor_grace_period:
48
,
user_default_external:
false
}
DEFAULTS_EE
=
{
elasticsearch_host:
ENV
[
'ELASTIC_HOST'
]
||
'localhost'
,
elasticsearch_port:
ENV
[
'ELASTIC_PORT'
]
||
'9200'
,
usage_ping_enabled:
true
}
DEFAULTS
=
DEFAULTS_CE
.
merge
(
DEFAULTS_EE
)
serialize
:restricted_visibility_levels
serialize
:import_sources
serialize
:disabled_oauth_sign_in_sources
,
Array
...
...
@@ -175,49 +224,7 @@ class ApplicationSetting < ActiveRecord::Base
end
def
self
.
create_from_defaults
create
(
default_projects_limit:
Settings
.
gitlab
[
'default_projects_limit'
],
default_branch_protection:
Settings
.
gitlab
[
'default_branch_protection'
],
signup_enabled:
Settings
.
gitlab
[
'signup_enabled'
],
signin_enabled:
Settings
.
gitlab
[
'signin_enabled'
],
gravatar_enabled:
Settings
.
gravatar
[
'enabled'
],
sign_in_text:
nil
,
after_sign_up_text:
nil
,
help_page_text:
nil
,
shared_runners_text:
nil
,
restricted_visibility_levels:
Settings
.
gitlab
[
'restricted_visibility_levels'
],
max_attachment_size:
Settings
.
gitlab
[
'max_attachment_size'
],
session_expire_delay:
Settings
.
gitlab
[
'session_expire_delay'
],
default_project_visibility:
Settings
.
gitlab
.
default_projects_features
[
'visibility_level'
],
default_snippet_visibility:
Settings
.
gitlab
.
default_projects_features
[
'visibility_level'
],
domain_whitelist:
Settings
.
gitlab
[
'domain_whitelist'
],
import_sources:
Gitlab
::
ImportSources
.
values
,
shared_runners_enabled:
Settings
.
gitlab_ci
[
'shared_runners_enabled'
],
max_artifacts_size:
Settings
.
artifacts
[
'max_size'
],
require_two_factor_authentication:
false
,
two_factor_grace_period:
48
,
recaptcha_enabled:
false
,
akismet_enabled:
false
,
koding_enabled:
false
,
koding_url:
nil
,
plantuml_enabled:
false
,
plantuml_url:
nil
,
repository_checks_enabled:
true
,
disabled_oauth_sign_in_sources:
[],
send_user_confirmation_email:
false
,
container_registry_token_expire_delay:
5
,
elasticsearch_host:
ENV
[
'ELASTIC_HOST'
]
||
'localhost'
,
elasticsearch_port:
ENV
[
'ELASTIC_PORT'
]
||
'9200'
,
usage_ping_enabled:
true
,
repository_storages:
[
'default'
],
user_default_external:
false
,
sidekiq_throttling_enabled:
false
,
housekeeping_enabled:
true
,
housekeeping_bitmaps_enabled:
true
,
housekeeping_incremental_repack_period:
10
,
housekeeping_full_repack_period:
50
,
housekeeping_gc_period:
200
,
)
create
(
DEFAULTS
)
end
def
elasticsearch_host
...
...
lib/gitlab/current_settings.rb
View file @
95280033
...
...
@@ -28,39 +28,7 @@ module Gitlab
end
def
fake_application_settings
OpenStruct
.
new
(
default_projects_limit:
Settings
.
gitlab
[
'default_projects_limit'
],
default_branch_protection:
Settings
.
gitlab
[
'default_branch_protection'
],
signup_enabled:
Settings
.
gitlab
[
'signup_enabled'
],
signin_enabled:
Settings
.
gitlab
[
'signin_enabled'
],
gravatar_enabled:
Settings
.
gravatar
[
'enabled'
],
koding_enabled:
false
,
plantuml_enabled:
false
,
sign_in_text:
nil
,
after_sign_up_text:
nil
,
help_page_text:
nil
,
shared_runners_text:
nil
,
restricted_visibility_levels:
Settings
.
gitlab
[
'restricted_visibility_levels'
],
max_attachment_size:
Settings
.
gitlab
[
'max_attachment_size'
],
session_expire_delay:
Settings
.
gitlab
[
'session_expire_delay'
],
default_project_visibility:
Settings
.
gitlab
.
default_projects_features
[
'visibility_level'
],
default_snippet_visibility:
Settings
.
gitlab
.
default_projects_features
[
'visibility_level'
],
domain_whitelist:
Settings
.
gitlab
[
'domain_whitelist'
],
import_sources:
%w[gitea github bitbucket gitlab google_code fogbugz git gitlab_project]
,
shared_runners_enabled:
Settings
.
gitlab_ci
[
'shared_runners_enabled'
],
max_artifacts_size:
Settings
.
artifacts
[
'max_size'
],
require_two_factor_authentication:
false
,
two_factor_grace_period:
48
,
akismet_enabled:
false
,
repository_checks_enabled:
true
,
container_registry_token_expire_delay:
5
,
elasticsearch_search:
false
,
elasticsearch_indexing:
false
,
elasticsearch_host:
ENV
[
'ELASTIC_HOST'
]
||
'localhost'
,
elasticsearch_port:
ENV
[
'ELASTIC_PORT'
]
||
'9200'
,
user_default_external:
false
,
sidekiq_throttling_enabled:
false
,
)
ApplicationSetting
.
new
(
ApplicationSetting
::
DEFAULTS
)
end
private
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment