bonsai-elasticsearch-rails 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bonsai-elasticsearch-rails.rb +2 -1
- data/lib/bonsai/elasticsearch/rails/railtie.rb +6 -6
- metadata +43 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a5bc3b05cb6368466916ed1771e52ac3970df8d
|
4
|
+
data.tar.gz: e5d48c65ab23c3049e8201a6ef82a82bbbe31065
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9092535510a230df09dfc770a944c6ab2d7f88d0aa15fc49311ff7cf86a540414b14ac9709229b682012a212ebf68e99e86f4c614fca4ec2a15968254da0c9fe
|
7
|
+
data.tar.gz: b595b1580dea6304b3d6f1ce77f6edac3c2e70e2796edd19524ddbfc18855fbadd7cc9dda33f133e32e9b09ab30a92de88b84055b3f3f5f7edfd2ef26388ea78
|
@@ -1,10 +1,9 @@
|
|
1
1
|
module Bonsai
|
2
2
|
module Elasticsearch
|
3
3
|
module Rails
|
4
|
+
# Use Railties
|
4
5
|
class Railtie < ::Rails::Railtie
|
5
|
-
|
6
6
|
config.after_initialize do
|
7
|
-
|
8
7
|
require 'elasticsearch/model'
|
9
8
|
require 'elasticsearch/rails'
|
10
9
|
|
@@ -13,19 +12,20 @@ module Bonsai
|
|
13
12
|
|
14
13
|
begin
|
15
14
|
if url && URI.parse(url)
|
16
|
-
filtered_url = url.sub(
|
17
|
-
logger.debug(
|
15
|
+
filtered_url = url.sub(/:[^:@]+@/, ':FILTERED@')
|
16
|
+
logger.debug('Bonsai: Initializing default Elasticsearch client'\
|
17
|
+
" with #{filtered_url}")
|
18
18
|
::Elasticsearch::Model.client = ::Elasticsearch::Client.new(
|
19
19
|
url: url
|
20
20
|
)
|
21
21
|
elsif ::Rails.env.production?
|
22
|
-
logger.debug(
|
22
|
+
logger.debug('BONSAI_URL not present, proceeding with'\
|
23
|
+
'Elasticsearch defaults.')
|
23
24
|
end
|
24
25
|
rescue URI::InvalidURIError => e
|
25
26
|
logger.error("Elasticsearch cluster URL is invalid: #{e.message}")
|
26
27
|
end
|
27
28
|
end
|
28
|
-
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bonsai-elasticsearch-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob Sears
|
@@ -9,36 +9,48 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2018-08-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: elasticsearch-model
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - "
|
18
|
+
- - ">"
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '0'
|
21
|
+
- - "~>"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: '5'
|
21
24
|
type: :runtime
|
22
25
|
prerelease: false
|
23
26
|
version_requirements: !ruby/object:Gem::Requirement
|
24
27
|
requirements:
|
25
|
-
- - "
|
28
|
+
- - ">"
|
26
29
|
- !ruby/object:Gem::Version
|
27
30
|
version: '0'
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '5'
|
28
34
|
- !ruby/object:Gem::Dependency
|
29
35
|
name: elasticsearch-rails
|
30
36
|
requirement: !ruby/object:Gem::Requirement
|
31
37
|
requirements:
|
32
|
-
- - "
|
38
|
+
- - ">"
|
33
39
|
- !ruby/object:Gem::Version
|
34
40
|
version: '0'
|
41
|
+
- - "~>"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '5'
|
35
44
|
type: :runtime
|
36
45
|
prerelease: false
|
37
46
|
version_requirements: !ruby/object:Gem::Requirement
|
38
47
|
requirements:
|
39
|
-
- - "
|
48
|
+
- - ">"
|
40
49
|
- !ruby/object:Gem::Version
|
41
50
|
version: '0'
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '5'
|
42
54
|
- !ruby/object:Gem::Dependency
|
43
55
|
name: bundler
|
44
56
|
requirement: !ruby/object:Gem::Requirement
|
@@ -68,36 +80,36 @@ dependencies:
|
|
68
80
|
- !ruby/object:Gem::Version
|
69
81
|
version: '11.0'
|
70
82
|
description: |2
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
83
|
+
This gem offers a shim to connect Rails apps with a Bonsai
|
84
|
+
Elasticsearch cluster. The official Elasticsearch gem package
|
85
|
+
requires some minor configuration tweaks in order to work
|
86
|
+
correctly with Bonsai (namely the client needs to be instantiated
|
87
|
+
with the cluster location and HTTP authentication details), and
|
88
|
+
the process can be somewhat complicated for users who are
|
89
|
+
unfamiliar with the system.
|
78
90
|
|
79
|
-
|
80
|
-
|
81
|
-
|
91
|
+
The bonsai-elasticsearch-rails gem automatically sets up the
|
92
|
+
Elasticsearch client correctly so users don't need to worry about
|
93
|
+
configuring it in their code or writing an initializer.
|
82
94
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
95
|
+
In order for the gem to work correctly, the application needs an
|
96
|
+
environment variable called `BONSAI_URL`, which is populated with
|
97
|
+
the complete Bonsai Elaticsearch cluster URL, including the HTTP
|
98
|
+
authentication. The cluster URL will follow this pattern:
|
87
99
|
|
88
|
-
|
100
|
+
https://user1234:pass5678@cluster-slug-123.aws-region-X.bonsai.io/
|
89
101
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
102
|
+
On Heroku, this variable is created and populated automatically
|
103
|
+
when Bonsai is added to the application. Heroku users therefore do
|
104
|
+
not need to perform any additional configuration to connect to
|
105
|
+
their cluster after adding the bonsai-elasticsearch-rails gem.
|
94
106
|
|
95
|
-
|
96
|
-
|
107
|
+
Users who are self-hosting their Rails app will need to make sure
|
108
|
+
this environment variable is present:
|
97
109
|
|
98
|
-
|
110
|
+
export BONSAI_URL="https://user1234:pass5678@aws-region-X.bonsai.io/"
|
99
111
|
|
100
|
-
|
112
|
+
The cluster URL is available via the Bonsai dashboard.
|
101
113
|
email:
|
102
114
|
- rob@onemorecloud.com
|
103
115
|
- nick@onemorecloud.com
|
@@ -127,8 +139,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
139
|
version: '0'
|
128
140
|
requirements: []
|
129
141
|
rubyforge_project:
|
130
|
-
rubygems_version: 2.
|
142
|
+
rubygems_version: 2.5.2
|
131
143
|
signing_key:
|
132
144
|
specification_version: 4
|
133
|
-
summary:
|
145
|
+
summary: Initialize your Elasticsearch client with Bonsai.
|
134
146
|
test_files: []
|