Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
rails-api-with-engine-template
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
rails-api-with-engine-template
Commits
69f8fcf5
Commit
69f8fcf5
authored
May 15, 2022
by
liyijie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: redis支持cluster
parent
c4b6c031
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
sidekiq.rb
src/config/sidekiq.rb
+9
-3
No files found.
src/config/sidekiq.rb
View file @
69f8fcf5
redis_config
=
{
url:
ENV
[
"REDIS_URL"
]
}
redis_config
.
merge!
(
password:
ENV
[
"REDIS_PASSWORD"
])
if
ENV
[
"REDIS_PASSWORD"
].
present?
redis_config
.
merge!
(
db:
ENV
[
"REDIS_DB"
])
if
ENV
[
"REDIS_DB"
].
present?
if
ENV
[
'REDIS_CLUSTER_URL'
].
present?
# cluster模式
redis_config
=
{
cluster:
[
ENV
[
"REDIS_CLUSTER_URL"
]
]
}
redis_config
.
merge!
(
password:
ENV
[
"REDIS_PASSWORD"
])
if
ENV
[
"REDIS_PASSWORD"
].
present?
else
redis_config
=
{
url:
ENV
[
"REDIS_URL"
]
}
redis_config
.
merge!
(
password:
ENV
[
"REDIS_PASSWORD"
])
if
ENV
[
"REDIS_PASSWORD"
].
present?
redis_config
.
merge!
(
db:
ENV
[
"REDIS_DB"
])
if
ENV
[
"REDIS_DB"
].
present?
end
Sidekiq
.
configure_server
do
|
config
|
config
.
redis
=
redis_config
...
...
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