<commit_before>require 'omniauth/patches'
require 'omniauth/dynamic_full_host'

# a setup app that handles dynamic config of CAS server
setup_app = Proc.new do |env|
  cas_server = URI.parse(Settler.safe_cas_server) rescue nil
  if cas_server
    env['omniauth.strategy'].options.merge! :host => cas_server.host,
                                            :port => cas_server.port,
                                            :path => (cas_server.path != "/" ? cas_server.path : nil),
                                            :ssl  => cas_server.scheme == "https"
  end
end

# tell Rails we use this middleware, with some default value just in case
Rails.application.config.middleware.use OmniAuth::Strategies::CAS, :host => "localhost",
                                                                   :port => "9292",
                                                                   :ssl => false,
                                                                   :setup => setup_app
<commit_msg>Use OmniAuth::Builder so we can add other omniauth strategies later<commit_after>require 'omniauth/patches'
require 'omniauth/dynamic_full_host'

# a setup app that handles dynamic config of CAS server
setup_app = Proc.new do |env|
  cas_server = URI.parse(Settler.safe_cas_server) rescue nil
  if cas_server
    env['omniauth.strategy'].options.merge! :host => cas_server.host,
                                            :port => cas_server.port,
                                            :path => (cas_server.path != "/" ? cas_server.path : nil),
                                            :ssl  => cas_server.scheme == "https"
  end
end

# tell Rails we use this middleware, with some default value just in case
Rails.application.config.middleware.use OmniAuth::Builder do
  use OmniAuth::Strategies::CAS, :host => "localhost",
                                 :port => "9292",
                                 :ssl => false,
                                 :setup => setup_app
end

{'fraction_non_alphanumeric': 0.09213820731096645, 'fraction_numerical': 0.00400600901352028, 'mean_word_length': 1.5037593984962405, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 21, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2206836', 'n_tokens_mistral': 497, 'n_tokens_neox': 478, 'n_words': 135}