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
4679107f
Commit
4679107f
authored
Jun 06, 2017
by
Pawel Chojnacki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle case where GITLAB_PROMETHEUS_METRICS_ENABLED is non boolean value by defaulting to false
parent
d26573c6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
db/fixtures/production/010_settings.rb
db/fixtures/production/010_settings.rb
+1
-1
spec/db/production/settings_spec.rb
spec/db/production/settings_spec.rb
+12
-0
No files found.
db/fixtures/production/010_settings.rb
View file @
4679107f
...
@@ -20,7 +20,7 @@ end
...
@@ -20,7 +20,7 @@ end
if
ENV
[
'GITLAB_PROMETHEUS_METRICS_ENABLED'
].
present?
if
ENV
[
'GITLAB_PROMETHEUS_METRICS_ENABLED'
].
present?
settings
=
Gitlab
::
CurrentSettings
.
current_application_settings
settings
=
Gitlab
::
CurrentSettings
.
current_application_settings
value
=
Gitlab
::
Utils
.
to_boolean
(
ENV
[
'GITLAB_PROMETHEUS_METRICS_ENABLED'
])
value
=
Gitlab
::
Utils
.
to_boolean
(
ENV
[
'GITLAB_PROMETHEUS_METRICS_ENABLED'
])
||
false
settings
.
prometheus_metrics_enabled
=
value
settings
.
prometheus_metrics_enabled
=
value
save
(
settings
,
'Prometheus metrics enabled flag'
)
save
(
settings
,
'Prometheus metrics enabled flag'
)
end
end
spec/db/production/settings_spec.rb
View file @
4679107f
...
@@ -42,5 +42,17 @@ describe 'seed production settings', lib: true do
...
@@ -42,5 +42,17 @@ describe 'seed production settings', lib: true do
expect
(
settings
.
prometheus_metrics_enabled
).
to
eq
(
false
)
expect
(
settings
.
prometheus_metrics_enabled
).
to
eq
(
false
)
end
end
end
end
context
'GITLAB_PROMETHEUS_METRICS_ENABLED is false'
do
before
do
stub_env
(
'GITLAB_PROMETHEUS_METRICS_ENABLED'
,
''
)
end
it
'prometheus_metrics_enabled is set to false'
do
load
(
settings_file
)
expect
(
settings
.
prometheus_metrics_enabled
).
to
eq
(
false
)
end
end
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