Skip to content

Commit 352cd89

Browse files
authored
Merge pull request #19 from jetzumy2k/master
Add method that will reload the initialize env_details
2 parents 5ab7f70 + 3820cf4 commit 352cd89

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

lib/stackify-api-ruby.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def internal_log level, msg
106106
def run async = true
107107
if Stackify.is_valid?
108108
at_exit { make_remained_job }
109-
t1 = Thread.new { Stackify.authorize }
109+
t1 = Thread.new { Stackify.authorize }
110110
case Stackify.configuration.mode
111111
when MODES[:both]
112112
t2 = start_logging

lib/stackify/authorization/authorizable.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ module ClassMethods
1111
@@auth_client = nil
1212

1313
def authorize attempts=3
14+
Stackify::EnvDetails.instance.set_rails_info
1415
@@auth_lock.synchronize do
1516
return unless @@auth_client.nil?
1617
@@auth_client = Stackify::Authorizable::AuthorizationClient.new

lib/stackify/env_details.rb

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,21 @@ class EnvDetails
1111

1212

1313
def initialize
14-
rails_info = defined?(Rails) ? Rails::Info.properties.to_h : nil
14+
set_env_properties
15+
end
16+
17+
def set_rails_info
18+
begin
19+
if (!Object.const_defined?('Rails::Info'))
20+
return
21+
end
22+
rescue NameError => exception
23+
return
24+
end
25+
set_env_properties (defined?(Rails) ? Rails::Info.properties.to_h : nil)
26+
end
27+
28+
def set_env_properties (rails_info = nil)
1529
@info = rails_info || { 'Application root' => Dir.pwd, 'Environment' => 'development'}
1630
@request_details = {}
1731
@app_name = app_name

0 commit comments

Comments
 (0)