Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ REDIS_PASSWORD=
TWILIO_ACCOUNT_SID=a
TWILIO_ACCOUNT_TOKEN=b
TWILIO_PHONE_NUMBER=c
SCRAPPER_SERVICE=https://sms-scrapper.rover.quenecesito.org/sms
SCRAPPER_SERVICE=https://sms-scrapper.rover.quenecesito.org/sms
SIDEKIQ_USERNAME=admin
SIDEKIQ_PASSWORD=admin
21 changes: 19 additions & 2 deletions config.ru
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# config.ru
require "active_support/security_utils"
require "./app"
run App
require "sidekiq"
require 'sidekiq/web'

Sidekiq.configure_client do |config|
config.redis = { url: "redis://#{ENV['REDIS_HOST']}:#{ENV['REDIS_PORT']}" }
end

use Rack::Env
Sidekiq::Web.use Rack::Auth::Basic, "Admin" do |username, password|
ActiveSupport::SecurityUtils.secure_compare(::Digest::SHA256.hexdigest(username), ::Digest::SHA256.hexdigest("#{ENV['SIDEKIQ_USERNAME']}")) &
ActiveSupport::SecurityUtils.secure_compare(::Digest::SHA256.hexdigest(password), ::Digest::SHA256.hexdigest("#{ENV['SIDEKIQ_PASSWORD']}"))
end

# config.ru
run Rack::URLMap.new(
"/sidekiq" => Sidekiq::Web,
"/" => App
)