<commit_before>require "kato/config"

def check_config hash
  hash.each do |key, value|
    if key.to_s.include?('-')
      $stderr.puts "WARNING: Config key #{key.inspect} contains a hyphen. AOK-style keys use _ to separate words."
    end
    check_config(value) if value.kind_of?(Hash)
  end
end

begin
  conf = Kato::Config.get("aok").symbolize_keys

  if ENV['RACK_ENV'] == 'test'
    require 'active_support/core_ext/hash/deep_merge'
    $test_config ||= {}
    conf.deep_merge!($test_config)
  end
  AppConfig = conf

  check_config(AppConfig)
  CCConfig = Kato::Config.get("cloud_controller_ng").symbolize_keys
rescue => ex
  $stderr.puts %[FATAL: Exception encountered while loading config: #{ex}\n#{ex.backtrace.join("\n")}]
  exit 1
end

unless AppConfig
  $stderr.puts %[FATAL: Unable to load config]
  exit 1
end<commit_msg>Bug #103886 AOK login info endpoint 500<commit_after>require "kato/config"

def check_config hash
  hash.each do |key, value|
    if key.to_s.include?('-')
      $stderr.puts "WARNING: Config key #{key.inspect} contains a hyphen. AOK-style keys use _ to separate words."
    end
    check_config(value) if value.kind_of?(Hash)
  end
end

begin
  conf = Kato::Config.get("aok").symbolize_keys

  if ENV['RACK_ENV'] == 'test'
    require 'active_support/core_ext/hash/deep_merge'
    $test_config ||= {}
    conf.deep_merge!($test_config)
  end
  AppConfig = conf

  check_config(AppConfig)
  CCConfig = Kato::Config.get("cloud_controller_ng").symbolize_keys

  # TODO: we no longer have these values since we lost .pkg-gitdescribe, however
  # they are still needed for CF API compat. Fake them out here.
  AppConfig[:commit_id] = 'unavailable' 
  AppConfig[:timestamp] = Time.now
rescue => ex
  $stderr.puts %[FATAL: Exception encountered while loading config: #{ex}\n#{ex.backtrace.join("\n")}]
  exit 1
end

unless AppConfig
  $stderr.puts %[FATAL: Unable to load config]
  exit 1
end
{'fraction_non_alphanumeric': 0.12480499219968799, 'fraction_numerical': 0.006760270410816433, 'mean_word_length': 4.08994708994709, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6136709', 'n_tokens_mistral': 689, 'n_tokens_neox': 669, 'n_words': 175}