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.45 lib/workarea/configuration/headless_chrome.rb
workarea-core-3.4.44 lib/workarea/configuration/headless_chrome.rb
workarea-core-3.4.43 lib/workarea/configuration/headless_chrome.rb
workarea-core-3.4.42 lib/workarea/configuration/headless_chrome.rb
workarea-core-3.4.41 lib/workarea/configuration/headless_chrome.rb
workarea-core-3.4.40 lib/workarea/configuration/headless_chrome.rb
workarea-core-3.4.39 lib/workarea/configuration/headless_chrome.rb
workarea-core-3.4.38 lib/workarea/configuration/headless_chrome.rb
workarea-core-3.4.37 lib/workarea/configuration/headless_chrome.rb
workarea-core-3.4.36 lib/workarea/configuration/headless_chrome.rb
workarea-core-3.4.35 lib/workarea/configuration/headless_chrome.rb
workarea-core-3.4.34 lib/workarea/configuration/headless_chrome.rb
workarea-core-3.4.33 lib/workarea/configuration/headless_chrome.rb
workarea-core-3.4.32 lib/workarea/configuration/headless_chrome.rb
workarea-core-3.4.31 lib/workarea/configuration/headless_chrome.rb
workarea-core-3.4.30 lib/workarea/configuration/headless_chrome.rb
workarea-core-3.4.29 lib/workarea/configuration/headless_chrome.rb
workarea-core-3.4.28 lib/workarea/configuration/headless_chrome.rb
workarea-core-3.4.27 lib/workarea/configuration/headless_chrome.rb
workarea-core-3.4.26 lib/workarea/configuration/headless_chrome.rb