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
5a901cdf
Commit
5a901cdf
authored
Apr 04, 2017
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Strip trailing forward slashes from elasticsearch URLs
parent
d5b883e1
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
0 deletions
+16
-0
app/models/application_setting.rb
app/models/application_setting.rb
+6
-0
changelogs/unreleased-ee/2039-fix-elasticsearch-url-with-path.yml
...gs/unreleased-ee/2039-fix-elasticsearch-url-with-path.yml
+4
-0
spec/models/application_setting_spec.rb
spec/models/application_setting_spec.rb
+6
-0
No files found.
app/models/application_setting.rb
View file @
5a901cdf
...
@@ -301,6 +301,12 @@ class ApplicationSetting < ActiveRecord::Base
...
@@ -301,6 +301,12 @@ class ApplicationSetting < ActiveRecord::Base
read_attribute
(
:elasticsearch_url
).
split
(
','
).
map
(
&
:strip
)
read_attribute
(
:elasticsearch_url
).
split
(
','
).
map
(
&
:strip
)
end
end
def
elasticsearch_url
=
(
values
)
cleaned
=
values
.
split
(
','
).
map
{
|
url
|
url
.
strip
.
gsub
(
%r{/*
\z
}
,
''
)
}
write_attribute
(
:elasticsearch_url
,
cleaned
.
join
(
','
))
end
def
elasticsearch_config
def
elasticsearch_config
{
{
url:
elasticsearch_url
,
url:
elasticsearch_url
,
...
...
changelogs/unreleased-ee/2039-fix-elasticsearch-url-with-path.yml
0 → 100644
View file @
5a901cdf
---
title
:
Fix Elasticsearch not working when URL ends with a forward slash
merge_request
:
1566
author
:
spec/models/application_setting_spec.rb
View file @
5a901cdf
...
@@ -299,6 +299,12 @@ describe ApplicationSetting, models: true do
...
@@ -299,6 +299,12 @@ describe ApplicationSetting, models: true do
expect
(
setting
.
elasticsearch_url
).
to
eq
(
%w[http://example.com https://invalid.invalid:9200]
)
expect
(
setting
.
elasticsearch_url
).
to
eq
(
%w[http://example.com https://invalid.invalid:9200]
)
end
end
it
'strips trailing slashes from URLs'
do
setting
.
elasticsearch_url
=
'http://example.com/, https://example.com:9200/, https://example.com:9200/prefix//'
expect
(
setting
.
elasticsearch_url
).
to
eq
(
%w[http://example.com https://example.com:9200 https://example.com:9200/prefix]
)
end
end
end
describe
'#elasticsearch_config'
do
describe
'#elasticsearch_config'
do
...
...
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