Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Using Thin with a framework other than Rails.

#30

Although Thin uses Rack, and so has the ability to work with lots of different frameworks (merb, rails, camping etc), but can only use the rails adapter since this is hard coded in the bin/thin file:

server.app = Rack::Adapter::Rails.new(options.merge(:root => options[:chdir]))

Is it possible that the adapter used could be overrided in a config option? Is this a good idea?

Reported by Alex MacCaw · February 1st, 2008 @ 05:37 AM

State: resolved
Milestone: 0.6.3
Assigned to: macournoyer macournoyer

Activity

  1. macournoyer
    macournoyer
    • State changed from new to open
    • Milestone set to 0.7.0

    the problem is that there's no convention as to how to initialize an adapter. Some require that your load the app first (Camping) and some do all the work of loading the app (Rails) and none take the same arguments also.

    What I could do though is take a Rack config.ru file as an argument and load that file instead of the adapter like the Rack rackup command does.

    What frameowkr did you want to server w/ thin script?

    February 1st, 2008 @ 10:11 AM

  2. Alex MacCaw
    Alex MacCaw

    I wanted to use my own custom framework. I ended up duplicating bin/thin and replacing that line. I think the option to load a rack config file would be a good idea, defaulting back to Rails if it can't be found.

    February 1st, 2008 @ 10:59 AM

  3. macournoyer
    macournoyer
    • State changed from open to resolved
    • Milestone changed from 0.7.0 to 0.6.3

    it's on git now:

    Add the --rackup option to load a Rack config file instead of the Rails adapter.

    So you can use any framework with the thin script and start cluster and stuff like that.

    A Rack config file is one that is usable through the rackup command and looks like this:

    use Rack::CommonLogger
    run MyCrazyRackAdapter.new(:uterly, 'cool')
    

    Then use it with thin like this:

    thin start --rackup config.ru
    

    Thx a lot for the suggestion Alex!

    February 6th, 2008 @ 12:48 AM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.