<commit_before>local env = require 'resty.env'
local router = require 'router'
local oauth

local _M = {
  _VERSION = '0.0.2'
}

function _M.new()
  local keycloak = env.get('RHSSO_ENDPOINT')
  if keycloak then
    oauth = require 'oauth.keycloak'
    oauth.init(keycloak)
  else
    oauth = require 'oauth.apicast_oauth'
  end
  return oauth.new()
end

function _M.router()
  -- TODO: use configuration to customize urls
  local r = router:new()
  oauth = _M.new()<commit_msg>Revert changes to require libraries every request<commit_after>local env = require 'resty.env'
local router = require 'router'
local apicast_oauth = require 'oauth.apicast_oauth'
local keycloak = require 'oauth.keycloak'

local _M = {
  _VERSION = '0.0.2'
}

function _M.new()
  local oauth
  if keycloak.configured then
    oauth = keycloak.new()
  else
    oauth = apicast_oauth.new()
  end
  return oauth
end

function _M.router()
  -- TODO: use configuration to customize urls
  local r = router:new()
  oauth = _M.new()
{'fraction_non_alphanumeric': 0.1068931068931069, 'fraction_numerical': 0.005994005994005994, 'mean_word_length': 3.682242990654206, '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': '2718515', 'n_tokens_mistral': 382, 'n_tokens_neox': 370, 'n_words': 101}