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
Boxiang Sun
gitlab-ce
Commits
6ddbee5d
Commit
6ddbee5d
authored
Sep 22, 2012
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Consolidate all Resque-related initializers into "4_resque"
parent
2cd0caaf
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
23 deletions
+30
-23
config/initializers/4_resque.rb
config/initializers/4_resque.rb
+30
-0
config/initializers/resque.rb
config/initializers/resque.rb
+0
-8
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/4_resque.rb
View file @
6ddbee5d
# 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'
)
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/resque.rb
deleted
100644 → 0
View file @
2cd0caaf
rails_root
=
ENV
[
'RAILS_ROOT'
]
||
File
.
dirname
(
__FILE__
)
+
'/../..'
rails_env
=
ENV
[
'RAILS_ENV'
]
||
'development'
config_file
=
File
.
join
(
rails_root
,
'config'
,
'resque.yml'
)
if
File
.
exists?
(
config_file
)
resque_config
=
YAML
.
load_file
(
config_file
)
Resque
.
redis
=
resque_config
[
rails_env
]
end
config/initializers/resque_authentication.rb
deleted
100644 → 0
View file @
2cd0caaf
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 @
2cd0caaf
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