bobthecow / genghis

The single-file MongoDB admin app
http://genghisapp.com
MIT License
1.45k stars 166 forks source link

passing MongoDB server details to genghis - ruby #194

Open czerasz opened 9 years ago

czerasz commented 9 years ago

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")
bobthecow commented 9 years ago

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.

czerasz commented 9 years ago

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