Skip to content

Commit d9655a9

Browse files
committed
Check to see if being run in Rails application and run in
before_initialize
1 parent a8eaaa3 commit d9655a9

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

lib/split.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,11 @@ def configure
6666
end
6767
end
6868

69-
Split.configure {}
69+
# Check to see if being run in a Rails application. If so, wait until before_initialize to run configuration so Gems that create ENV variables have the chance to initialize first.
70+
if defined?(Rails::Railtie)
71+
class Railtie < Rails::Railtie
72+
config.before_initialize { Split.configure {} }
73+
end
74+
else
75+
Split.configure {}
76+
end

0 commit comments

Comments
 (0)