Deployment via RackUp (static stuff needs to be under public/ for X-Sendfile).

This commit is contained in:
Paul van Tilburg 2010-06-01 00:09:16 +02:00
parent 42a8917f5c
commit 29333b0a1d
3 changed files with 15 additions and 2 deletions

View File

@ -7,7 +7,8 @@ Markaby::Builder.set(:indent, 2)
Camping.goes :Anne
IMAGE_DIR = Pathname.new(__FILE__).dirname + "images"
PUBLIC_DIR = Pathname.new(__FILE__).dirname + "public"
IMAGE_DIR = PUBLIC_DIR + "images"
module Anne
@ -117,7 +118,8 @@ module Anne::Controllers
def get(file)
unless file =~ /\.\./
headers["Content-Type"] = "image/png"
headers["X-Sendfile"] = (IMAGE_DIR + file).to_s
headers["X-Sendfile"] =
(IMAGE_DIR.relative_path_from(PUBLIC_DIR) + file).to_s
else
@status = 403
"You're not allowed to retrieve #{file}!"

11
config.ru Normal file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env rackup1.8
$LOAD_PATH.unshift "/home/paul/Projects/anne-survey/lib"
require "anne-survey"
Camping::Models::Base.establish_connection( :adapter => 'sqlite3',
:database => '/home/paul/.camping.db',
:timeout => 10000 )
run Anne

BIN
public/images/tuelogo.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB