I'm trying to get a reasonable idea of how you can create an application on top of rubies / racks (or, even better, an existing structure) that manages something that is equivalent to WordPress. In particular, with the ability to serve multiple sites from the same code base, each of which has its own functions and configuration.
Suppose, for example:
- example.com using auth, pages, blog modules.
- forum.example.com → auth, forum modules
- api.example.com → auth, api modules
This test case seems to work, including in a production environment:
class Foo
end
require 'rack'
use Rack::ShowExceptions
use Rack::CommonLogger
run lambda { |env|
case env['HTTP_HOST']
when /^test\./
require './test'
[200, {'Content-Type'=>'text/plain'}, "#{Kernel.const_defined? :Foo}"]
else
[200, {'Content-Type'=>'text/plain'}, "#{Kernel.const_defined? :Foo}"]
end
}
Mostly working in environments with little, if any, so far, I'm a little nervous that this can come back and bite me along the way.
, / , ? ( - ? , , ? .., , .)
, ?
( Rails , . , . , , , example.com/site1, example.com/site2 .. )
, :