OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/lib/open_project/configuration/asset_host.rb

30 lines
620 B

module OpenProject
module Configuration
module AssetHost
module_function
def value
Proc.new do |source|
asset_host if serve_through_asset_host? source
end
end
def asset_host
@asset_host ||= OpenProject::Configuration["rails_asset_host"]
end
def serve_through_asset_host?(source)
src = String(source)
include_prefixes.any? { |prefix| src.start_with? prefix }
end
##
# Only serve resources with these prefixes from the asset host.
def include_prefixes
["/assets/"]
end
end
end
end