<commit_before>require File.expand_path('../boot', __FILE__)

# Pick the frameworks you want:
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
# require "sprockets/railtie"
# require "rails/test_unit/railtie"

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env)

module GhcrApi
  class Application < Rails::Application

    config.autoload_paths += [ "#{config.root}/lib" ]

    config.assets.enabled = false

    config.middleware.use Rack::MethodOverride
    config.middleware.use ActionDispatch::Cookies
    config.middleware.use ActionDispatch::Session::CookieStore
    config.middleware.use ActionDispatch::Flash

    config.middleware.use Rack::OAuth2::Server::Resource::Bearer, 'Github Commit Review API' do |req|
      AccessToken.find_by_token(req.access_token) || req.invalid_token!
    end

    config.middleware.use OmniAuth::Builder do
      provider :developer unless Rails.env.production?
      provider :github, ENV['GITHUB_CLIENT_ID'], ENV['GITHUB_CLIENT_SECRET'],
        request_path: "/api/v1/authorize", callback_path: "/api/v1/authorize/callback",
        provider_ignores_state: true, scope: 'repo user:email'
    end

    config.secret_key_base = 'ghcr-api'

    config.cache_store = :redis_store, "#{ENV['REDIS_URL'] || ENV['REDISTOGO_URL']}/ghcr-api:#{Rails.env}:cache"
  end
end<commit_msg>Set time_zone<commit_after>require File.expand_path('../boot', __FILE__)

# Pick the frameworks you want:
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
# require "sprockets/railtie"
# require "rails/test_unit/railtie"

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env)

module GhcrApi
  class Application < Rails::Application

    config.autoload_paths += [ "#{config.root}/lib" ]

    config.assets.enabled = false

    config.time_zone = 'Warsaw'

    config.middleware.use Rack::MethodOverride
    config.middleware.use ActionDispatch::Cookies
    config.middleware.use ActionDispatch::Session::CookieStore
    config.middleware.use ActionDispatch::Flash

    config.middleware.use Rack::OAuth2::Server::Resource::Bearer, 'Github Commit Review API' do |req|
      AccessToken.find_by_token(req.access_token) || req.invalid_token!
    end

    config.middleware.use OmniAuth::Builder do
      provider :developer unless Rails.env.production?
      provider :github, ENV['GITHUB_CLIENT_ID'], ENV['GITHUB_CLIENT_SECRET'],
        request_path: "/api/v1/authorize", callback_path: "/api/v1/authorize/callback",
        provider_ignores_state: true, scope: 'repo user:email'
    end

    config.secret_key_base = 'ghcr-api'

    config.cache_store = :redis_store, "#{ENV['REDIS_URL'] || ENV['REDISTOGO_URL']}/ghcr-api:#{Rails.env}:cache"
  end
end
{'fraction_non_alphanumeric': 0.12268284462419952, 'fraction_numerical': 0.0020222446916076846, 'mean_word_length': 4.808219178082192, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2318821', 'n_tokens_mistral': 994, 'n_tokens_neox': 954, 'n_words': 188}