<commit_before>CarrierWave.configure do |config|
  # For testing, upload files to local `tmp` folder.
  config.storage = :file

  if Rails.env.test?
    config.enable_processing = false
    config.root = "#{Rails.root}/tmp"
  elsif Rails.env.production?
    config.fog_credentials = {
        provider: 'AWS',
        aws_access_key_id: ENV['S3_KEY'],
        aws_secret_access_key: ENV['S3_SECRET'],
        region: ENV['S3_REGION']
    }
    config.storage = :fog
  end

  config.cache_dir = "#{Rails.root}/tmp/uploads" # To let CarrierWave work on heroku
  config.fog_directory = ENV['S3_BUCKET_NAME']
end
<commit_msg>Update config for carrierwave. Use S3 only if key present<commit_after>CarrierWave.configure do |config|
  # For testing, upload files to local `tmp` folder.
  config.storage = :file
  config.cache_dir = "#{Rails.root}/tmp/uploads" # To let CarrierWave work on heroku

  if Rails.env.test?
    config.enable_processing = false
    config.root = "#{Rails.root}/tmp"
  elsif Rails.env.production?
    if ENV['S3_KEY'].present?
      config.fog_credentials = {
          provider: 'AWS',
          aws_access_key_id: ENV['S3_KEY'],
          aws_secret_access_key: ENV['S3_SECRET'],
          region: ENV['S3_REGION']
      }
      config.storage = :fog
      config.fog_directory = ENV['S3_BUCKET_NAME']
    end
  end
end

{'fraction_non_alphanumeric': 0.1185682326621924, 'fraction_numerical': 0.007457121551081283, 'mean_word_length': 3.1677018633540373, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '909421', 'n_tokens_mistral': 480, 'n_tokens_neox': 470, 'n_words': 100}