firefighter 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4ebbe214d98c7909950821f879de7c65c5901ac0dfa1594d99251349907bde46
4
- data.tar.gz: 8cfd532905aa5e07a208bfcda957786de52e1795b5e3f3976c7a44cd4638437b
3
+ metadata.gz: 00b94b5878f703b6332b33493fe3c09ed2b9860a8d402952ce91fd047640ee67
4
+ data.tar.gz: 586bb23666589a122d0722b9772e0d850d27fca12c49eb9ddf70ffd52cc47c3d
5
5
  SHA512:
6
- metadata.gz: d148780c482d59e2b13909abe163ba4a80ad013003c2cb16fe075614fa17f62357ac9fabe40269e9995737a0dddf3a918055b05a17fcfcbcffee4b83cb7bacb3
7
- data.tar.gz: 04ed2e8b446bd4bcf360a44b08c64bc28e279bd6cf90e0ab83fff9bc41f988d674857d88325aa0c4fd27c37d5f5f28550fa3461561c39f17d6f4c233e3b366fd
6
+ metadata.gz: 0ba9000e62c3baf013389f774faee390fff31fce12deb119e53d269ff300a7630ac20a10c1de2badb4b9936c24db602b6d13a336c98f017210b25dfda72156b0
7
+ data.tar.gz: 356363578224f2e8a95959a7f3a4ce1d770f0f74abd9e13ecbb645950db304fe8c2acaeacde444d6b9e34fcf1aa8b40297d03b191701cc63af1d6e96e1ebf02a
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ### 1.3.0
4
+
5
+ - adds db_host for realtime database to enable different hosting locations
6
+
3
7
  ### 1.2.0
4
8
 
5
9
  - adds `Firefighter::Identitytoolkit#verify_password`
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- firefighter (1.2.0)
4
+ firefighter (1.3.0)
5
5
  http (> 3.0)
6
6
  jwt (> 2.0)
7
7
 
data/README.md CHANGED
@@ -45,6 +45,8 @@ account = identitytoolkit.verify_password('test@test.de', 'totalgeheimespasswort
45
45
  # from_env uses environment variables:
46
46
  # - FIREBASE_WEB_DB_NAME
47
47
  # - FIREBASE_WEB_DB_SECRET
48
+ # - FIREBASE_WEB_DB_HOST (defaults to host for us-central1)
49
+
48
50
  realtime_database = Firefighter::RealtimeDatabase.from_env
49
51
 
50
52
  realtime_database.write("some-path/key", {some: 'data'})
@@ -5,13 +5,21 @@ module Firefighter
5
5
  def self.from_env
6
6
  new(
7
7
  db_name: ENV['FIREBASE_WEB_DB_NAME'],
8
- db_secret: ENV['FIREBASE_WEB_DB_SECRET']
8
+ db_secret: ENV['FIREBASE_WEB_DB_SECRET'],
9
+ db_host: ENV['FIREBASE_WEB_DB_HOST'] || DEFAULT_DB_HOST,
9
10
  )
10
11
  end
11
12
 
12
- def initialize(db_name:, db_secret:)
13
+ DB_HOSTS = {
14
+ 'us-central1' => 'firebaseio.com',
15
+ 'europe-west1' => 'europe-west1.firebasedatabase.app',
16
+ }
17
+ DEFAULT_DB_HOST = DB_HOSTS['us-central1']
18
+
19
+ def initialize(db_name:, db_secret:, db_host: DEFAULT_DB_HOST)
13
20
  @db_name = db_name
14
21
  @db_secret = db_secret
22
+ @db_host = db_host
15
23
  end
16
24
 
17
25
  def listen(path)
@@ -45,7 +53,7 @@ module Firefighter
45
53
  private
46
54
 
47
55
  def endpoint(path)
48
- "https://#{@db_name}.firebaseio.com/#{path}.json?auth=#{@db_secret}"
56
+ "https://#{@db_name}.#{@db_host}/#{path}.json?auth=#{@db_secret}"
49
57
  end
50
58
  end
51
59
  end
@@ -1,3 +1,3 @@
1
1
  module Firefighter
2
- VERSION = "1.2.0"
2
+ VERSION = "1.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: firefighter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - phoet
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-03 00:00:00.000000000 Z
11
+ date: 2021-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http