<commit_before>require 'sinatra'
require 'rack/ssl'
require 'encrypted_cookie'
require 'sendgrid-ruby'
require 'redis'
require 'securerandom'
require 'zipruby'
require './calfresh'
require './faxer'

class CalfreshWeb < Sinatra::Base
  if settings.environment == :production
    use Rack::Session::EncryptedCookie, :secret => ENV['SECRET_TOKEN']
    use Rack::SSL unless settings.environment
  elsif settings.environment == :development
    # Breaking tests, but needed for dev use
    #enable :sessions
  end

  configure do
    set :redis_url, URI.parse(ENV["REDISTOGO_URL"])
  end

  before do
    puts session<commit_msg>enable sessions (unencrypted) in dev<commit_after>require 'sinatra'
require 'rack/ssl'
require 'encrypted_cookie'
require 'sendgrid-ruby'
require 'redis'
require 'securerandom'
require 'zipruby'
require './calfresh'
require './faxer'

class CalfreshWeb < Sinatra::Base
  if settings.environment == :production
    use Rack::Session::EncryptedCookie, :secret => ENV['SECRET_TOKEN']
    use Rack::SSL unless settings.environment
  elsif settings.environment == :development
    # Breaking tests, but needed for dev use
    enable :sessions
  end

  configure do
    set :redis_url, URI.parse(ENV["REDISTOGO_URL"])
  end

  before do
    puts session
{'fraction_non_alphanumeric': 0.10455974842767296, 'fraction_numerical': 0.0, 'mean_word_length': 4.760180995475113, 'pattern_counts': {'":': 0, '<': 5, '<?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': '569099', 'n_tokens_mistral': 410, 'n_tokens_neox': 393, 'n_words': 113}