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
0709cf3e
Commit
0709cf3e
authored
May 01, 2022
by
liyijie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 更新template内容,增加sidekiq配置
parent
eb141795
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
8 deletions
+37
-8
ohm.rb
src/config/ohm.rb
+0
-7
redis.rb
src/config/redis.rb
+7
-0
sidekiq.rb
src/config/sidekiq.rb
+11
-0
sidekiq.yml
src/config/sidekiq.yml
+15
-0
template.rb
template.rb
+4
-1
No files found.
src/config/ohm.rb
deleted
100644 → 0
View file @
eb141795
Ohm
.
redis
=
Redic
.
new
(
ENV
[
'REDIS_URL'
])
$redis
=
ENV
[
'REDIS_PASSWORD'
].
present?
?
Redis
.
new
(
url:
ENV
[
'REDIS_URL'
],
password:
ENV
[
'REDIS_PASSWORD'
]
)
:
Redis
.
new
(
url:
ENV
[
'REDIS_URL'
])
$token_redis
=
Redis
::
Namespace
.
new
(
:token
,
redis:
$redis
)
$verify_code_redis
=
Redis
::
Namespace
.
new
(
:verify_code
,
redis:
$redis
)
$limit_redis
=
Redis
::
Namespace
.
new
(
:limit
,
redis:
$redis
)
src/config/redis.rb
View file @
0709cf3e
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?
Ohm
.
redis
=
Redis
.
new
(
redis_config
)
$redis
=
Redis
.
new
(
redis_config
)
$token_redis
=
Redis
::
Namespace
.
new
(
:token
,
redis:
$redis
)
Redis
::
Objects
.
redis
=
Redis
.
new
(
url:
ENV
[
"REDIS_URL"
],
db:
ENV
[
"REDIS_DB"
],
password:
ENV
[
"REDIS_PASSWORD"
])
src/config/sidekiq.rb
0 → 100644
View file @
0709cf3e
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?
Sidekiq
.
configure_server
do
|
config
|
config
.
redis
=
redis_config
end
Sidekiq
.
configure_client
do
|
config
|
config
.
redis
=
redis_config
end
src/config/sidekiq.yml
0 → 100644
View file @
0709cf3e
:concurrency
:
15
:logfile
:
./log/sidekiq.log
:pidfile
:
./.pids/sidekiq.pid
:queues
:
-
default
:max_retries
:
2
:schedule
:
# task_scheduler_reptile:
# cron: '30 0 * * *' # 每天
# class: TaskSchedulerReptile
# description: '爬取新闻和轮播图'
# announcement_scheduler:
# cron: '0 */1 * * *' # 每1小时
# class: 'AnnouncementScheduler'
# description: '获取通知公告'
template.rb
View file @
0709cf3e
...
...
@@ -30,6 +30,8 @@ gsub_file 'app/controllers/application_controller.rb', 'respond_to :html', 'resp
gem
'rubocop'
,
require:
false
gem
'rubocop-rails'
gem
'rubocop-performance'
gem
'sidekiq'
gem
'sidekiq-scheduler'
gem
'simple_controller'
,
tallty:
'open-source/simple_controller'
gem
'acts_as_pasting'
,
tallty:
'open-source/acts_as_pasting'
...
...
@@ -124,11 +126,11 @@ after_bundle do
remove_file
'config/mongoid.yml'
copy_file
'src/config/mongoid.yml'
,
'config/mongoid.yml'
copy_file
'src/config/sidekiq.yml'
,
'config/sidekiq.yml'
remove_file
'config/storage.yml'
copy_file
'src/config/storage.yml'
,
'config/storage.yml'
gsub_file
'config/environments/production.rb'
,
'config.active_storage.service = :local'
,
'config.active_storage.service = :s3'
copy_file
'src/config/ohm.rb'
,
'config/initializers/ohm.rb'
remove_file
'config/initializers/cors.rb'
copy_file
'src/config/cors.rb'
,
'config/initializers/cors.rb'
remove_file
'spec/swagger_helper.rb'
...
...
@@ -139,6 +141,7 @@ after_bundle do
copy_file
'src/app/models/user.rb'
,
'app/models/user.rb'
copy_file
'src/app/models/app.rb'
,
'app/models/app.rb'
copy_file
'src/config/redis.rb'
,
'config/initializers/redis.rb'
copy_file
'src/config/sidekiq.rb'
,
'config/initializers/sidekiq.rb'
gsub_file
'config/puma.rb'
,
'app_name_to_replace'
,
app_name
gsub_file
'spec/swagger_helper.rb'
,
'app_name_to_replace'
,
app_name
...
...
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