Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

604 B
Raw Blame
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
        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