curator 0.9.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/curator/configuration.rb +1 -1
- data/lib/curator/mongo/data_store.rb +17 -2
- data/lib/curator/riak/data_store.rb +2 -0
- metadata +5 -5
@@ -6,13 +6,28 @@ module Curator
|
|
6
6
|
class DataStore
|
7
7
|
def client
|
8
8
|
return @client if @client
|
9
|
+
|
10
|
+
if Curator.config.client
|
11
|
+
@client = Curator.config.client
|
12
|
+
@database_name = Curator.config.database
|
13
|
+
return @client
|
14
|
+
end
|
15
|
+
|
16
|
+
if ENV['MONGO_URI']
|
17
|
+
require 'uri'
|
18
|
+
uri = URI.parse(ENV['MONGO_URI'])
|
19
|
+
@database_name = uri.path.gsub(/^\//, '')
|
20
|
+
@client = ::Mongo::Connection.from_uri(uri.to_s)
|
21
|
+
return @client
|
22
|
+
end
|
23
|
+
|
9
24
|
config = YAML.load(File.read(Curator.config.mongo_config_file))[Curator.config.environment]
|
10
25
|
config = config.symbolize_keys
|
11
26
|
|
12
27
|
host = config.delete(:host)
|
13
28
|
port = config.delete(:port)
|
14
|
-
password = config.delete(:password)
|
15
|
-
username = config.delete(:username)
|
29
|
+
password = ENV['MONGO_PASSWORD'] || config.delete(:password)
|
30
|
+
username = ENV['MONGO_USERNAME'] || config.delete(:username)
|
16
31
|
@database_name = config.delete(:database) || default_db_name
|
17
32
|
@client = ::Mongo::Connection.new(host, port, config)
|
18
33
|
@client.add_auth(@database_name, username, password) if username and password
|
@@ -6,6 +6,8 @@ module Curator
|
|
6
6
|
class DataStore
|
7
7
|
def client
|
8
8
|
return @client if @client
|
9
|
+
return @client = Curator.config.client if Curator.config.client
|
10
|
+
|
9
11
|
yml_config = YAML.load(File.read(Curator.config.riak_config_file))[Curator.config.environment]
|
10
12
|
@client = ::Riak::Client.new(yml_config)
|
11
13
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: curator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-04-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -114,7 +114,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
114
114
|
version: '0'
|
115
115
|
segments:
|
116
116
|
- 0
|
117
|
-
hash:
|
117
|
+
hash: 12316657956024539
|
118
118
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
119
|
none: false
|
120
120
|
requirements:
|
@@ -123,10 +123,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
123
|
version: '0'
|
124
124
|
segments:
|
125
125
|
- 0
|
126
|
-
hash:
|
126
|
+
hash: 12316657956024539
|
127
127
|
requirements: []
|
128
128
|
rubyforge_project:
|
129
|
-
rubygems_version: 1.8.
|
129
|
+
rubygems_version: 1.8.25
|
130
130
|
signing_key:
|
131
131
|
specification_version: 3
|
132
132
|
summary: Model and repository framework
|