Update sidekiq credentials

This commit is contained in:
Eugene Burmakin 2025-05-08 11:31:18 +02:00
parent e2d0807e9a
commit e9680fd6e4
3 changed files with 14 additions and 10 deletions

View file

@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## Added
- Vector maps are supported in non-self-hosted mode.
- Credentials for Sidekiq UI are now being set via environment variables: `SIDEKIQ_USERNAME` and `SIDEKIQ_PASSWORD`. Default credentials are `sidekiq` and `password`.
- Credentials for Sidekiq UI are now being set via environment variables: `SIDEKIQ_USERNAME` and `SIDEKIQ_PASSWORD`. Default credentials are `sidekiq` and `password`. If you don't set them, in self-hosted mode, Sidekiq UI will not be protected by basic auth.
- New import page now shows progress of the upload.
## Changed

View file

@ -7,6 +7,7 @@ Rails.application.routes.draw do
mount Rswag::Api::Engine => '/api-docs'
mount Rswag::Ui::Engine => '/api-docs'
unless DawarichSettings.self_hosted?
Sidekiq::Web.use(Rack::Auth::Basic) do |username, password|
ActiveSupport::SecurityUtils.secure_compare(
::Digest::SHA256.hexdigest(username),
@ -17,6 +18,7 @@ Rails.application.routes.draw do
::Digest::SHA256.hexdigest(ENV['SIDEKIQ_PASSWORD'])
)
end
end
authenticate :user, lambda { |u|
(u.admin? && DawarichSettings.self_hosted?) ||

View file

@ -5,7 +5,9 @@ namespace :points do
task migrate_to_lonlat: :environment do
puts 'Updating points to use lonlat...'
points = Point.where(longitude: nil, latitude: nil).select(:id, :longitude, :latitude, :raw_data, :user_id)
points =
Point.where(longitude: nil, latitude: nil)
.select(:id, :longitude, :latitude, :raw_data, :user_id, :timestamp)
points.find_each do |point|
Points::RawDataLonlatExtractor.new(point).call