web47core 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/app/models/concerns/core_system_configuration.rb +19 -31
- data/lib/web47core/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f1bb05a864b2fba4e1d35563c71958ade83637d8881843a26430027e8c3878f
|
4
|
+
data.tar.gz: 4e39e3f4064f9d81fb4636f20eae6326e7d84e5a206adb57ba9fb6c601723efe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d2855e00108d8d40c7a4fb6d976ae621d7eb8be6ba1530f0260457d032a7227dc695fce39796af5d101ef0a0ddb1a5adc11c46f4a4e825ccee7724ddcc54855
|
7
|
+
data.tar.gz: 71b746532f35a9439b2b3816ec6e64c26079e4e72bcad370c6726407492543231c8962c1a0229e4bcb16b60bf9197bea5c1995cf8dddc2efadc81386eb9b338c
|
@@ -16,6 +16,7 @@ module CoreSystemConfiguration
|
|
16
16
|
#
|
17
17
|
def self.included(base)
|
18
18
|
base.class_eval do
|
19
|
+
attr_accessor :configuration
|
19
20
|
#
|
20
21
|
# Fields
|
21
22
|
#
|
@@ -73,27 +74,12 @@ module CoreSystemConfiguration
|
|
73
74
|
end
|
74
75
|
|
75
76
|
module ClassMethods
|
76
|
-
#
|
77
|
-
# Fetch the system configuration based on environment name. First try the rails cache
|
78
|
-
# if not there, then go to the database.
|
79
|
-
#
|
80
|
-
# Also, if an argument error is thrown, then just fetch from the database.
|
81
|
-
#
|
82
77
|
def configuration
|
83
|
-
|
84
|
-
|
85
|
-
begin
|
86
|
-
config = Rails.cache.fetch(cache_key, expires_in: 90.seconds) do
|
87
|
-
SystemConfiguration.find_by(environment: Rails.env)
|
88
|
-
end
|
89
|
-
rescue StandardError
|
90
|
-
# This seems to happen in testing relative to Country, when it does, remove
|
91
|
-
# ourselves from the cache and return the DB entry.
|
92
|
-
Rails.cache.delete cache_key
|
93
|
-
config = SystemConfiguration.find_or_create_by!(environment: Rails.env)
|
94
|
-
end
|
78
|
+
@configuration ||= SystemConfiguration.find_or_create_by!(environment: Rails.env)
|
79
|
+
end
|
95
80
|
|
96
|
-
|
81
|
+
def reset
|
82
|
+
@configuration = nil
|
97
83
|
end
|
98
84
|
|
99
85
|
def smtp_configuration
|
@@ -110,19 +96,21 @@ module CoreSystemConfiguration
|
|
110
96
|
#
|
111
97
|
# NOTE: Currently ignored Codacy issue: When using 'method_missing', fall back on 'super'
|
112
98
|
#
|
113
|
-
# rubocop:disable Style/MethodMissingSuper
|
114
99
|
def method_missing(method, *args, &_block)
|
115
|
-
configuration.
|
100
|
+
if configuration.respond_to?(method)
|
101
|
+
configuration.send(method, *args)
|
102
|
+
else
|
103
|
+
super
|
104
|
+
end
|
116
105
|
end
|
117
106
|
|
118
|
-
def respond_to?(method_name,
|
119
|
-
|
107
|
+
def respond_to?(method_name, include_private = false)
|
108
|
+
configuration.respond_to?(method_name, include_private) || super
|
120
109
|
end
|
121
110
|
|
122
|
-
def respond_to_missing?(method_name,
|
123
|
-
|
111
|
+
def respond_to_missing?(method_name, include_private = false)
|
112
|
+
configuration.respond_to?(method_name, include_private) || super
|
124
113
|
end
|
125
|
-
# rubocop:enable Style/MethodMissingSuper
|
126
114
|
end
|
127
115
|
|
128
116
|
#
|
@@ -203,7 +191,7 @@ module CoreSystemConfiguration
|
|
203
191
|
config = SystemConfiguration.configuration
|
204
192
|
path = if config.zendesk_configured? && user.present?
|
205
193
|
time_now = Time.now.to_i
|
206
|
-
jti = "#{time_now}/#{rand(36**64).to_s(36)}"
|
194
|
+
jti = "#{time_now}/#{rand(36 ** 64).to_s(36)}"
|
207
195
|
payload = { jwt: JWT.encode({ iat: time_now, # Seconds since epoch, determine when this token is stale
|
208
196
|
jti: jti, # Unique token identifier, helps prevent replay attacks
|
209
197
|
name: user.name,
|
@@ -262,12 +250,12 @@ module CoreSystemConfiguration
|
|
262
250
|
slack_api_url.present?
|
263
251
|
end
|
264
252
|
|
265
|
-
private
|
253
|
+
# private
|
266
254
|
|
267
255
|
#
|
268
256
|
# Clear the cache when the object is saved
|
269
257
|
#
|
270
|
-
def clear_cache
|
271
|
-
|
272
|
-
end
|
258
|
+
# def clear_cache
|
259
|
+
# Rails.cache.delete "SystemConfiguration::#{Rails.env}"
|
260
|
+
# end
|
273
261
|
end
|
data/lib/web47core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: web47core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Schroeder
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|