fluent-plugin-heroku-postgres 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8ecf7d3ef69df838b352ea889c49c71b25a94a96
4
- data.tar.gz: e0741e2ccc67340a3dadb2749aa533de42af8457
3
+ metadata.gz: 0a8bd9fa04dd201e735d0b5bb1c4118ca8c028d7
4
+ data.tar.gz: 9f519b9edfe57740e3eb0da63310a10511e92513
5
5
  SHA512:
6
- metadata.gz: 5b9fc5a2003b82543053a609bd575c99e43c127641bcbe18028af7b226e858c6b4bc89e8f3626853ab4652b70827ebaad20a5079cc5a233a7a48b96f09de023d
7
- data.tar.gz: 763addc1eb379dc106a55ab6780e5ff43386e9bbc2cd93f9fafb99a6507bd24acc5af423c13bf1037c57b1a0c2b8c5f2305ced564ed0995587f02f6274f05329
6
+ metadata.gz: 6263bd93ffbc53e08aaabf8a11340ce0c3ab13f4ffe401032b3ed0addb8ec013a689a08ec435a0c8f79db0d60586bb71efe741e82d4764ec7817b93c0230f174
7
+ data.tar.gz: e38b57a31feb8ab9ee4edd54c2dc72fbe879526efa1dc82cebe486a547da0fed414756688b1da56048d5059b3d5b750364226a4c269fd7256e9c14dd78aaedaa
data/README.md CHANGED
@@ -38,6 +38,22 @@ match('postgres.**') {
38
38
  web: bundle exec fluentd -c td-agent-conf.rb -i "source { type :http; port $PORT }" -vv
39
39
  ```
40
40
 
41
+ ## Option
42
+
43
+ ### Basic Authentication
44
+
45
+ * Using ":basic_auth_http" source type
46
+
47
+ ```
48
+ # Procfile
49
+ web: bundle exec fluentd -c td-agent-conf.rb -i "source { type :basic_auth_http; port $PORT }" -vv
50
+ ```
51
+
52
+ * Set ENV on Heroku config
53
+
54
+ USERNAME=name
55
+ PASSWORD=passwd
56
+
41
57
 
42
58
  ## Contributing
43
59
 
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "fluent-plugin-heroku-postgres"
7
- spec.version = '0.0.3'
7
+ spec.version = '0.0.4'
8
8
  spec.authors = ["Naohiro Sakuma"]
9
9
  spec.email = ["nao.bear@gmail.com"]
10
10
  spec.summary = %q{fluent plugin to insert on Heroku Postgre.}
@@ -0,0 +1,22 @@
1
+ module Fluent
2
+ class BasicAuthHttp < Fluent::HttpInput
3
+ Plugin.register_input('basic_auth_http', self)
4
+
5
+ def on_request(path_info, params)
6
+ unless authenticate(params["HTTP_AUTHORIZATION"])
7
+ return ['401 Unauthorized', {'Content-type'=>'text/plain'}, "401 Unauthorized\n"]
8
+ end
9
+
10
+ super
11
+ end
12
+
13
+ private
14
+
15
+ def authenticate(value)
16
+ return false unless value
17
+ require 'base64'
18
+ base64_str = value.split(' ', 2).last || ''
19
+ Base64.decode64(base64_str) == "#{ENV['USERNAME']}:#{ENV['PASSWORD']}"
20
+ end
21
+ end
22
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-heroku-postgres
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naohiro Sakuma
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-13 00:00:00.000000000 Z
11
+ date: 2014-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -93,6 +93,7 @@ files:
93
93
  - README.md
94
94
  - Rakefile
95
95
  - fluent-plugin-heroku-postgres.gemspec
96
+ - lib/fluent/plugin/in_basic_auth_http.rb
96
97
  - lib/fluent/plugin/out_heroku_postgres.rb
97
98
  homepage: https://github.com/n-sakuma/fluent-plugin-heroku-postgres
98
99
  licenses: