<commit_before>require 'dragonfly'

# Configure
Dragonfly.app.configure do
  plugin :imagemagick

  secret "<KEY>"

  url_format "/media/:site/images/:name"

  # datastore :file,
  #   root_path: Rails.root.join('public/system/dragonfly', Rails.env),
  #   server_root: Rails.root.join('public')
  datastore :s3,
    :bucket_name => PRIVATE['aws']['bucket'],
    :access_key_id => PRIVATE['aws']['access_key_id'],
    :secret_access_key => PRIVATE['aws']['secret_access_key'],
    :url_scheme => 'https'
end

# Logger
Dragonfly.logger = Rails.logger

# Mount as middleware
Rails.application.middleware.use Dragonfly::Middleware

# Add model functionality
if defined?(ActiveRecord::Base)
  ActiveRecord::Base.extend Dragonfly::Model
  ActiveRecord::Base.extend Dragonfly::Model::Validations
end
<commit_msg>use s3 for dragonfly only in production<commit_after>require 'dragonfly'

# Configure
Dragonfly.app.configure do
  plugin :imagemagick

  secret "<KEY>"

  url_format "/media/:site/images/:name"

  if Rails.env.production?
    datastore :s3,
      :bucket_name => PRIVATE['aws']['bucket'],
      :access_key_id => PRIVATE['aws']['access_key_id'],
      :secret_access_key => PRIVATE['aws']['secret_access_key'],
      :url_scheme => 'https'
  else
    datastore :file,
      :root_path => Rails.root.join('public/system/dragonfly', Rails.env),
      :server_root => Rails.root.join('public')
  end

end

# Logger
Dragonfly.logger = Rails.logger

# Mount as middleware
Rails.application.middleware.use Dragonfly::Middleware

# Add model functionality
if defined?(ActiveRecord::Base)
  ActiveRecord::Base.extend Dragonfly::Model
  ActiveRecord::Base.extend Dragonfly::Model::Validations
end

{'fraction_non_alphanumeric': 0.1392330383480826, 'fraction_numerical': 0.0017699115044247787, 'mean_word_length': 4.992932862190813, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '7198675', 'n_tokens_mistral': 567, 'n_tokens_neox': 553, 'n_words': 104}