istox 0.3.0 → 0.3.1

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
  SHA256:
3
- metadata.gz: bf92c8de5dc5407049f3a216cbf0d63df754aa1c4d23473a2a87a9628d71bbc8
4
- data.tar.gz: 2cfce3c6ef9c45edcff3f9c34d8e27def16e6ed6cf94343acd9d810052d2ecb8
3
+ metadata.gz: 46a3913c2d38594116c1a3a4aec26566f953c064221f73ad0bdec23ff89c21f7
4
+ data.tar.gz: 392609770199b5ee76613665b29147f7c1fe7eeda87ab5f9be90357f66b321d4
5
5
  SHA512:
6
- metadata.gz: f91e99b9bb7ae5fab66068e14d7c049187662b7265afcb45c7538af6b72bbd4c0e8d60eb7b0afd0e3eb60412709b32a42f38a3eebab8f07d8ef56d64f5fa76cd
7
- data.tar.gz: 7f48b151239306cdfe9b754c195f7f2d01608efddec8342aaf10f779f6693fdf4b9ece2cf3208345e79ae3e605cc94b9ec5382ed229895a7fc7e28645bc5afe0
6
+ metadata.gz: a5fdeb603a9fc36584f6d39c7e391e2e8bf065b501079c9ef3b00cc5b84449b54fe01ebd2244052cd50a7732f3afb9d5a38e2f03c1a23591d8e6ae35f0dc252d
7
+ data.tar.gz: 67962eade0a7b56b18dbdb796a02c7ef6f4e61cd671eca59e0d7912ba0272145300ae359113d32a8070bcc87e1ddcedd6677caf23a495aa8256dedfe30b67640
@@ -3,10 +3,12 @@ require 'istox/helpers/logger'
3
3
  module Istox
4
4
  class GrpcClient
5
5
  class << self
6
- def add_host(host_type, url)
6
+ def add_host(host_type, url, cert: nil)
7
7
  @@hosts = {} unless defined?(@@hosts)
8
+ @@certs = {} unless defined?(@@certs)
8
9
 
9
10
  @@hosts[host_type] = url
11
+ @@certs[host_type] = cert
10
12
  end
11
13
 
12
14
  def add_interceptors(interceptor)
@@ -16,7 +18,7 @@ module Istox
16
18
  end
17
19
 
18
20
  def configure_grpc_logger
19
- Gruf.grpc_logger = log
21
+ Gruf.grpc_logger = log
20
22
  end
21
23
 
22
24
  def call(host_type, service, method, grpc_retries_count: 1, **keyword_args)
@@ -78,11 +80,13 @@ module Istox
78
80
  @@services = {} unless defined?(@@services)
79
81
 
80
82
  host_url = @@hosts[host_type]
83
+ cert_path = @@certs[host_type]
81
84
  raise StandardError, 'Unable to find host, have you forgotten to add host to grpc client?' unless host_url
82
85
 
83
86
  log.info 'Reinitiating to grpc host at ' + host_url
84
87
  t1 = Time.now
85
- @@services[get_key(host_type, service)] = ::Gruf::Client.new(service: service, options: { hostname: host_url }, client_options: client_options)
88
+ @@services[get_key(host_type, service)] = ::Gruf::Client.new(service: service, ssl_certificate_file: cert_path,
89
+ options: { hostname: host_url }, client_options: client_options)
86
90
  log.info "Time taken for reinitiating grpc host: #{Time.now - t1} seconds"
87
91
  end
88
92
 
@@ -24,6 +24,14 @@ module Istox
24
24
  db: 6
25
25
  ))
26
26
  end
27
+
28
+ # for send_grid email templates cache
29
+ def sendgrid_email_templates
30
+ @sendgrid_email_templates ||= Redis::Namespace.new(:sendgrid_email_templates, redis: Redis.new(
31
+ url: ENV['REDIS_URL'] || 'redis://127.0.0.1:16379',
32
+ db: 5
33
+ ))
34
+ end
27
35
  end
28
36
  end
29
37
  end
data/lib/istox/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Istox
2
- VERSION = '0.3.0'.freeze
2
+ VERSION = '0.3.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: istox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Siong Leng
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-01-26 00:00:00.000000000 Z
11
+ date: 2022-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: amazing_print