<commit_before>require File.expand_path('config/site.rb') if File.exists?('config/site.rb')

require "bundler"
Bundler.require

require 'active_support/all'

require 'rails/observers/activerecord/base'
require 'rails/observers/activerecord/observer'

unless defined?(LOGGER)
  require 'logger'
  LOGGER = Logger.new($stdout)
  LOGGER.level = Logger::INFO
end

Dir.glob('./lib/checkpoint/**/*.rb').each{ |lib| require lib }

$config = YAML::load(File.open("config/database.yml"))
ENV['RACK_ENV'] ||= "development"
environment = ENV['RACK_ENV']

ActiveRecord::Base.add_observer RiverNotifications.instance

ActiveRecord::Base.establish_connection($config[environment])
$memcached = Dalli::Client.new unless ENV['RACK_ENV'] == 'test'

require File.expand_path('config/strategies.rb') if File.exists?('config/strategies.rb')

Pebblebed.config do
  service :vanilla
  service :checkpoint
end<commit_msg>Refactor how ActiveRecord is configured.<commit_after>require File.expand_path('config/site.rb') if File.exists?('config/site.rb')

require "bundler"
Bundler.require

require 'active_support/all'

require 'rails/observers/activerecord/base'
require 'rails/observers/activerecord/observer'

unless defined?(LOGGER)
  require 'logger'
  LOGGER = Logger.new($stdout)
  LOGGER.level = Logger::INFO
end

Dir.glob('./lib/checkpoint/**/*.rb').each{ |lib| require lib }

ENV['RACK_ENV'] ||= "development"
environment = ENV['RACK_ENV']

ActiveRecord::Base.add_observer RiverNotifications.instance unless environment == 'test'
ActiveRecord::Base.logger = LOGGER
ActiveRecord::Base.configurations = YAML.load(
  ERB.new(File.read(File.expand_path("../database.yml", __FILE__))).result)
ActiveRecord::Base.include_root_in_json = true
ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations[environment])

$memcached = Dalli::Client.new unless ENV['RACK_ENV'] == 'test'

require File.expand_path('config/strategies.rb') if File.exists?('config/strategies.rb')

Pebblebed.config do
  service :vanilla
  service :checkpoint
end
{'fraction_non_alphanumeric': 0.14792899408284024, 'fraction_numerical': 0.0, 'mean_word_length': 6.744274809160306, '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': '5409176', 'n_tokens_mistral': 686, 'n_tokens_neox': 669, 'n_words': 114}