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
Kazuhiko Shiozaki
gitlab-ce
Commits
923eb89c
Commit
923eb89c
authored
Sep 23, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1528 from tsigo/resque_init
Consolidate Resque-related initializers
parents
ad3eefdc
6ddbee5d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
16 deletions
+31
-16
config/initializers/4_resque.rb
config/initializers/4_resque.rb
+31
-0
config/initializers/4_resque_queues.rb
config/initializers/4_resque_queues.rb
+0
-1
config/initializers/resque_authentication.rb
config/initializers/resque_authentication.rb
+0
-14
config/initializers/resque_mailer.rb
config/initializers/resque_mailer.rb
+0
-1
No files found.
config/initializers/resque.rb
→
config/initializers/
4_
resque.rb
View file @
923eb89c
# Custom Redis configuration
rails_root
=
ENV
[
'RAILS_ROOT'
]
||
File
.
dirname
(
__FILE__
)
+
'/../..'
rails_env
=
ENV
[
'RAILS_ENV'
]
||
'development'
config_file
=
File
.
join
(
rails_root
,
'config'
,
'resque.yml'
)
...
...
@@ -6,3 +7,25 @@ if File.exists?(config_file)
resque_config
=
YAML
.
load_file
(
config_file
)
Resque
.
redis
=
resque_config
[
rails_env
]
end
# Queues
Resque
.
watch_queue
(
PostReceive
.
instance_variable_get
(
"@queue"
))
# Authentication
require
'resque/server'
class
Authentication
def
initialize
(
app
)
@app
=
app
end
def
call
(
env
)
account
=
env
[
'warden'
].
authenticate!
(
:database_authenticatable
,
:rememberable
,
scope: :user
)
raise
"Access denied"
if
!
account
.
admin?
@app
.
call
(
env
)
end
end
Resque
::
Server
.
use
Authentication
# Mailer
Resque
::
Mailer
.
excluded_environments
=
[]
config/initializers/4_resque_queues.rb
deleted
100644 → 0
View file @
ad3eefdc
Resque
.
watch_queue
(
PostReceive
.
instance_variable_get
(
"@queue"
))
config/initializers/resque_authentication.rb
deleted
100644 → 0
View file @
ad3eefdc
require
'resque/server'
class
Authentication
def
initialize
(
app
)
@app
=
app
end
def
call
(
env
)
account
=
env
[
'warden'
].
authenticate!
(
:database_authenticatable
,
:rememberable
,
scope: :user
)
raise
"Access denied"
if
!
account
.
admin?
@app
.
call
(
env
)
end
end
Resque
::
Server
.
use
Authentication
\ No newline at end of file
config/initializers/resque_mailer.rb
deleted
100644 → 0
View file @
ad3eefdc
Resque
::
Mailer
.
excluded_environments
=
[]
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