<commit_before>require 'trade_tariff_frontend/api_constraints'
require 'trade_tariff_frontend/request_forwarder'
require 'redis_resolver'

module TradeTariffFrontend
  autoload :Presenter,      'trade_tariff_frontend/presenter'
  autoload :ViewContext,    'trade_tariff_frontend/view_context'

  module_function

  # API Endpoints of the Tariff API app that can be reached
  # via Frontend
  def accessible_api_endpoints
    %w[sections chapters headings commodities updates monetary_exchange_rates]
  end

  def production?
    ENV["GOVUK_APP_DOMAIN"] == "tariff-frontend-production.cloudapps.digital"
  end

  def production_domain?(domain)
    domain == "www.trade-tariff.service.gov.uk"
  end

  def currency_picker_enabled?
    ENV["CURRENCY_PICKER"].to_i == 1
  end

  # Number of suggestions returned to select2
  def suggestions_count
    10
  end

  # Email of the user who receives all info/error notifications, feedback
  def from_email
    ENV["TARIFF_FROM_EMAIL"]
  end

  def to_email
    ENV["TARIFF_TO_EMAIL"]
  end

  def regulations_enabled?
    return true unless ENV['HIDE_REGULATIONS']

    ENV.fetch('HIDE_REGULATIONS') != 'true'
  end

  # CDS locking and authentication
  module Locking

    module_function

    def locked?
      ENV['CDS_LOCKED'].present?
    end

    def allowed_ip(ip)
      allowed_ips = ENV['CDS_IP_WHITELIST']&.split(',') || []
      allowed_ips.include?(ip)
    end

    def authenticable?
      ENV['CDS_LOCKED'].present? && ENV['CDS_USER'].present? && ENV['CDS_PASSWORD'].present?
    end

    def user
      ENV['CDS_USER']
    end

    def password
      ENV['<PASSWORD>']
    end
  end
end<commit_msg>improver ip list retrieving.<commit_after>require 'trade_tariff_frontend/api_constraints'
require 'trade_tariff_frontend/request_forwarder'
require 'redis_resolver'

module TradeTariffFrontend
  autoload :Presenter,      'trade_tariff_frontend/presenter'
  autoload :ViewContext,    'trade_tariff_frontend/view_context'

  module_function

  # API Endpoints of the Tariff API app that can be reached
  # via Frontend
  def accessible_api_endpoints
    %w[sections chapters headings commodities updates monetary_exchange_rates]
  end

  def production?
    ENV["GOVUK_APP_DOMAIN"] == "tariff-frontend-production.cloudapps.digital"
  end

  def production_domain?(domain)
    domain == "www.trade-tariff.service.gov.uk"
  end

  def currency_picker_enabled?
    ENV["CURRENCY_PICKER"].to_i == 1
  end

  # Number of suggestions returned to select2
  def suggestions_count
    10
  end

  # Email of the user who receives all info/error notifications, feedback
  def from_email
    ENV["TARIFF_FROM_EMAIL"]
  end

  def to_email
    ENV["TARIFF_TO_EMAIL"]
  end

  def regulations_enabled?
    return true unless ENV['HIDE_REGULATIONS']

    ENV.fetch('HIDE_REGULATIONS') != 'true'
  end

  # CDS locking and authentication
  module Locking

    module_function

    def locked?
      ENV['CDS_LOCKED'].present?
    end

    def allowed_ip(ip)
      allowed_ips = ENV['CDS_IP_WHITELIST']&.split(',')&.map(&:squish) || []
      allowed_ips.include?(ip)
    end

    def authenticable?
      ENV['CDS_LOCKED'].present? && ENV['CDS_USER'].present? && ENV['CDS_PASSWORD'].present?
    end

    def user
      ENV['CDS_USER']
    end

    def password
      ENV['CDS_PASSWORD']
    end
  end
end
{'fraction_non_alphanumeric': 0.090065828845003, 'fraction_numerical': 0.0023937761819269898, 'mean_word_length': 3.7217514124293785, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1755006', 'n_tokens_mistral': 1197, 'n_tokens_neox': 1110, 'n_words': 246}