2020-07-28 05:09:41 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module Pages
|
|
|
|
class Settings < ::SimpleDelegator
|
|
|
|
DiskAccessDenied = Class.new(StandardError)
|
|
|
|
|
|
|
|
def path
|
2021-04-20 05:09:48 -04:00
|
|
|
report_denied_disk_access
|
2020-07-28 05:09:41 -04:00
|
|
|
|
|
|
|
super
|
|
|
|
end
|
2021-04-06 08:09:21 -04:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def disk_access_denied?
|
|
|
|
return true unless ::Settings.pages.local_store&.enabled
|
|
|
|
|
2022-03-02 10:16:07 -05:00
|
|
|
::Gitlab::Runtime.puma? && !::Gitlab::Runtime.test_suite?
|
2021-04-06 08:09:21 -04:00
|
|
|
end
|
2021-04-20 05:09:48 -04:00
|
|
|
|
|
|
|
def report_denied_disk_access
|
|
|
|
raise DiskAccessDenied if disk_access_denied?
|
2021-04-26 08:09:44 -04:00
|
|
|
rescue StandardError => e
|
2021-04-20 05:09:48 -04:00
|
|
|
::Gitlab::ErrorTracking.track_exception(e)
|
|
|
|
end
|
2020-07-28 05:09:41 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|