blob: 419dbe0606107554236ba85e1abd556bb03c1dfa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# Custom Redis configuration
config_file = Rails.root.join('config', 'resque.yml')
if File.exists?(config_file)
resque_config = YAML.load_file(config_file)
Resque.redis = resque_config[Rails.env]
end
Resque.redis.namespace = 'resque:gitlab'
# 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 = []
|