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
Jérome Perrin
gitlab-ce
Commits
02d8575a
Commit
02d8575a
authored
Jan 13, 2015
by
DJ Mountney
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check for database connection before loading current application settings
parent
ff7f4a13
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
19 deletions
+4
-19
lib/gitlab/current_settings.rb
lib/gitlab/current_settings.rb
+4
-19
No files found.
lib/gitlab/current_settings.rb
View file @
02d8575a
module
Gitlab
module
CurrentSettings
def
current_application_settings
begin
if
ActiveRecord
::
Base
.
connection
.
table_exists?
(
'application_settings'
)
ApplicationSetting
.
current
||
ApplicationSetting
.
create_from_defaults
else
fake_application_settings
end
rescue
ActiveRecord
::
NoDatabaseError
,
database_adapter
.
constantize
::
Error
if
ActiveRecord
::
Base
.
connected?
&&
ActiveRecord
::
Base
.
connection
.
table_exists?
(
'application_settings'
)
ApplicationSetting
.
current
||
ApplicationSetting
.
create_from_defaults
else
fake_application_settings
end
end
...
...
@@ -22,16 +18,5 @@ module Gitlab
sign_in_text:
Settings
.
extra
[
'sign_in_text'
],
)
end
# We need to check which database is setup
# but we cannot assume that the database exists already.
# Not checking this will break "rake gitlab:setup".
def
database_adapter
if
Rails
.
configuration
.
database_configuration
[
Rails
.
env
][
'adapter'
]
==
'mysql2'
"Mysql2"
else
"PG"
end
end
end
end
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