45 lines
951 B
Ruby
45 lines
951 B
Ruby
# This is a replacement of the couchbase settings gem. The quality of this gem is not sufficient to
|
|
# work with. Since couchbase structures/docstore are using CouchbaseSetting we supply the right settings
|
|
# here
|
|
|
|
module CouchbaseSetting
|
|
mattr_accessor :config_type
|
|
mattr_accessor :configs
|
|
|
|
def self.server
|
|
config :server, default: '127.0.0.1'
|
|
end
|
|
|
|
def self.bucket
|
|
config :bucket, default: 'mozo'
|
|
end
|
|
|
|
def self.config(setting, default: nil)
|
|
configs[config_type][Rails.env.to_sym][setting] || default
|
|
end
|
|
end
|
|
|
|
CouchbaseSetting.configs = {
|
|
supplier_counters: {
|
|
development: {
|
|
bucket: 'mozo_development'
|
|
},
|
|
test:{
|
|
bucket: 'mozo_development'
|
|
},
|
|
production: {}
|
|
},
|
|
queue: {
|
|
development: {
|
|
bucket: 'mozo_development'
|
|
},
|
|
test:{
|
|
bucket: 'mozo_development'
|
|
},
|
|
production: {}
|
|
}
|
|
}
|
|
|
|
# only one in use at the moment
|
|
CouchbaseSetting.config_type = :supplier_counters
|