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
a532c604
Commit
a532c604
authored
Dec 14, 2016
by
Semyon Pupkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow to use ENV variables in redis config
parent
f80ab37c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
2 deletions
+28
-2
changelogs/unreleased/env-var-in-redis-config.yml
changelogs/unreleased/env-var-in-redis-config.yml
+4
-0
doc/install/installation.md
doc/install/installation.md
+6
-0
lib/gitlab/redis.rb
lib/gitlab/redis.rb
+1
-1
spec/fixtures/config/redis_config_with_env.yml
spec/fixtures/config/redis_config_with_env.yml
+2
-0
spec/lib/gitlab/redis_spec.rb
spec/lib/gitlab/redis_spec.rb
+15
-1
No files found.
changelogs/unreleased/env-var-in-redis-config.yml
0 → 100644
View file @
a532c604
---
title
:
Allow to use ENV variables in redis config
merge_request
:
8073
author
:
Semyon Pupkov
doc/install/installation.md
View file @
a532c604
...
...
@@ -601,6 +601,12 @@ If you want to connect the Redis server via socket, then use the "unix:" URL sch
production:
url: unix:/path/to/redis/socket
Also you can use environment variables in the
`config/resque.yml`
file:
# example
production:
url: <%= ENV.fetch('GITLAB_REDIS_URL') %>
### Custom SSH Connection
If you are running SSH on a non-standard port, you must change the GitLab user's SSH config.
...
...
lib/gitlab/redis.rb
View file @
a532c604
...
...
@@ -42,7 +42,7 @@ module Gitlab
return
@_raw_config
if
defined?
(
@_raw_config
)
begin
@_raw_config
=
File
.
read
(
CONFIG_FILE
)
.
freeze
@_raw_config
=
ERB
.
new
(
File
.
read
(
CONFIG_FILE
)).
result
.
freeze
rescue
Errno
::
ENOENT
@_raw_config
=
false
end
...
...
spec/fixtures/config/redis_config_with_env.yml
0 → 100644
View file @
a532c604
test
:
url
:
<%= ENV['TEST_GITLAB_REDIS_URL'] %>
spec/lib/gitlab/redis_spec.rb
View file @
a532c604
require
'spec_helper'
describe
Gitlab
::
Redis
do
let
(
:redis_config
)
{
Rails
.
root
.
join
(
'config'
,
'resque.yml'
).
to_s
}
include
StubENV
before
(
:each
)
{
clear_raw_config
}
after
(
:each
)
{
clear_raw_config
}
...
...
@@ -72,6 +72,20 @@ describe Gitlab::Redis do
expect
(
url2
).
not_to
end_with
(
'foobar'
)
end
context
'when yml file with env variable'
do
let
(
:redis_config
)
{
Rails
.
root
.
join
(
'spec/fixtures/config/redis_config_with_env.yml'
)
}
before
do
stub_env
(
'TEST_GITLAB_REDIS_URL'
,
'redis://redishost:6379'
)
end
it
'reads redis url from env variable'
do
stub_const
(
"
#{
described_class
}
::CONFIG_FILE"
,
redis_config
)
expect
(
described_class
.
url
).
to
eq
'redis://redishost:6379'
end
end
end
describe
'._raw_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