#!/usr/local/bin/ruby
# -*- coding: utf-8 -*-

Rev = "1.8"
app_uri = "postal"
basedir = "/app/www.yadiary.net/lib/#{app_uri}/#{Rev}"
confdir = "/app/www.yadiary.net/data/#{app_uri}/#{Rev}"
$:.unshift "#{basedir}/lib"

ENV['GEM_HOME'] = "#{basedir}/gems"
require 'rubygems'
require 'fcgi'
require 'cgi'
require 'yapostal'

FCGI.each {|request|
 Thread.current[:current_request] = nil

  out = request.out
  main = YaPostal::Controller.new(confdir, request)
  
  out.print main.run
  
  request.finish
}
