genghis
genghis copied to clipboard
passing MongoDB server details to genghis - ruby
How can I tell genghis
about my MongoDB server details?
What I mean is something like this:
require 'genghis'
require File.expand_path('../app/app.rb', __FILE__)
run Rack::URLMap.new \
'/' => Company::App::Server.new,
'/genghis' => Genghis::Server.new("10.0.10.1:27017")
It's not possible to pass it to the constructor, but that's a great idea. I'll look into getting something into the next version.
In the meantime, you can set ENV['GENGHIS_SERVERS']
to your server URI and it'll do the same thing.
Thx for the great tip @bobthecow.
Used the following code and it worked like a charm:
require 'genghis'
require File.expand_path('../app/app.rb', __FILE__)
ENV['GENGHIS_SERVERS'] = "10.0.10.1:27017"
run Rack::URLMap.new \
'/' => Company::App::Server.new,
'/genghis' => Genghis::Server.new