Class AppConfig::Storage::Mongo
In: lib/app_config/storage/mongo.rb
Parent: Storage::Base

Mongo storage method. FIXME: Come up with a way of removing stale config entries.

Methods

[]   []=   new  

Constants

DEFAULTS = { :host => 'localhost', :port => '27017', :database => 'app_config', :collection => 'app_config', :user => nil, :password => nil

Public Class methods

[Source]

# File lib/app_config/storage/mongo.rb, line 24
      def initialize(options)
        super(DEFAULTS.merge(options))
        @connected = false
        @options = DEFAULTS.merge(options)
        setup_connection
        @data = fetch_data
      end

Public Instance methods

[Source]

# File lib/app_config/storage/mongo.rb, line 32
      def [](key)
        @data[key]
      end

[Source]

# File lib/app_config/storage/mongo.rb, line 36
      def []=(key, value)
        @data[key] = value
        save!
      end

[Validate]