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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
8dbac708
Commit
8dbac708
authored
Jan 21, 2017
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Merge branch 'backport-fix-load-error' into 'master'"
This reverts merge request !8671
parent
d6529dbb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
51 deletions
+47
-51
app/models/application_setting.rb
app/models/application_setting.rb
+44
-48
lib/gitlab/current_settings.rb
lib/gitlab/current_settings.rb
+3
-3
No files found.
app/models/application_setting.rb
View file @
8dbac708
...
@@ -13,6 +13,49 @@ class ApplicationSetting < ActiveRecord::Base
...
@@ -13,6 +13,49 @@ class ApplicationSetting < ActiveRecord::Base
[
\r\n
] # any number of newline characters
[
\r\n
] # any number of newline characters
}x
}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
=
DEFAULTS_CE
serialize
:restricted_visibility_levels
serialize
:restricted_visibility_levels
serialize
:import_sources
serialize
:import_sources
serialize
:disabled_oauth_sign_in_sources
,
Array
serialize
:disabled_oauth_sign_in_sources
,
Array
...
@@ -148,53 +191,6 @@ class ApplicationSetting < ActiveRecord::Base
...
@@ -148,53 +191,6 @@ class ApplicationSetting < ActiveRecord::Base
Rails
.
cache
.
write
(
CACHE_KEY
,
self
)
Rails
.
cache
.
write
(
CACHE_KEY
,
self
)
end
end
def
self
.
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
}
end
def
self
.
defaults
defaults_ce
end
def
self
.
current
def
self
.
current
Rails
.
cache
.
fetch
(
CACHE_KEY
)
do
Rails
.
cache
.
fetch
(
CACHE_KEY
)
do
ApplicationSetting
.
last
ApplicationSetting
.
last
...
@@ -210,7 +206,7 @@ class ApplicationSetting < ActiveRecord::Base
...
@@ -210,7 +206,7 @@ class ApplicationSetting < ActiveRecord::Base
end
end
def
self
.
create_from_defaults
def
self
.
create_from_defaults
create
(
defaults
)
create
(
DEFAULTS
)
end
end
def
home_page_url_column_exist
def
home_page_url_column_exist
...
...
lib/gitlab/current_settings.rb
View file @
8dbac708
...
@@ -30,15 +30,15 @@ module Gitlab
...
@@ -30,15 +30,15 @@ module Gitlab
end
end
def
in_memory_application_settings
def
in_memory_application_settings
@in_memory_application_settings
||=
::
ApplicationSetting
.
new
(
::
ApplicationSetting
.
defaults
)
@in_memory_application_settings
||=
ApplicationSetting
.
new
(
ApplicationSetting
::
DEFAULTS
)
# In case migrations the application_settings table is not created yet,
# In case migrations the application_settings table is not created yet,
# we fallback to a simple OpenStruct
# we fallback to a simple OpenStruct
rescue
ActiveRecord
::
StatementInvalid
,
ActiveRecord
::
UnknownAttributeError
rescue
ActiveRecord
::
StatementInvalid
fake_application_settings
fake_application_settings
end
end
def
fake_application_settings
def
fake_application_settings
OpenStruct
.
new
(
::
ApplicationSetting
.
defaults
)
OpenStruct
.
new
(
ApplicationSetting
::
DEFAULTS
)
end
end
private
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