Sha256: 066fd652e19be6d98aff20a02061fa59a1f1e9058a94cb33e8f335406d2536e7

Contents?: true

Size: 954 Bytes

Versions: 34

Compression:

Stored size: 954 Bytes

Contents

module Workarea
  module Configuration
    module HeadlessChrome
      extend self

      # TODO v3.5
      #
      # Allow apps to configure both Chrome options and arguments separately, as
      # any given release to Chrome may require changing these separately.
      #
      def load
        Workarea.config.headless_chrome_args = Workarea.config.headless_chrome_options
      end

      def options
        default_options.merge(env_options)
      end

      def default_options
        { args: args, w3c: false }
      end

      def env_options
        parsed = if ENV['WORKAREA_HEADLESS_CHROME_OPTIONS'].blank?
          {}
        else
          JSON.parse(ENV['WORKAREA_HEADLESS_CHROME_OPTIONS'])
        end

        parsed.symbolize_keys
      end

      def args
        (Workarea.config.headless_chrome_args + env_args).uniq
      end

      def env_args
        ENV['WORKAREA_HEADLESS_CHROME_ARGS'].to_s.split
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
workarea-core-3.4.25 lib/workarea/configuration/headless_chrome.rb
workarea-core-3.4.24 lib/workarea/configuration/headless_chrome.rb
workarea-core-3.4.23 lib/workarea/configuration/headless_chrome.rb
workarea-core-3.4.22 lib/workarea/configuration/headless_chrome.rb
workarea-core-3.4.21 lib/workarea/configuration/headless_chrome.rb
workarea-core-3.4.20 lib/workarea/configuration/headless_chrome.rb
workarea-core-3.4.19 lib/workarea/configuration/headless_chrome.rb
workarea-core-3.4.18 lib/workarea/configuration/headless_chrome.rb
workarea-core-3.4.17 lib/workarea/configuration/headless_chrome.rb
workarea-core-3.4.16 lib/workarea/configuration/headless_chrome.rb
workarea-core-3.4.15 lib/workarea/configuration/headless_chrome.rb
workarea-core-3.4.14 lib/workarea/configuration/headless_chrome.rb
workarea-core-3.4.13 lib/workarea/configuration/headless_chrome.rb
workarea-core-3.4.12 lib/workarea/configuration/headless_chrome.rb