lib/dotenv/s3/rails.rb in dotenv-s3-0.2.0 vs lib/dotenv/s3/rails.rb in dotenv-s3-0.2.1
- old
+ new
@@ -1,18 +1,20 @@
-module Dotenv
- module S3
- class Railtie < Rails::Railtie
- config.before_configuration { load_from_tempfile }
+if defined?(Rails)
+ module Dotenv
+ module S3
+ class Railtie < Rails::Railtie
+ config.before_configuration { load_from_tempfile }
- def self.load_from_tempfile
- if ENV["ENABLE_S3_ENVFILE"]
- Dotenv::S3.load(
- bucket: ENV["ENVFILE_BUCKET_NAME"],
- filename: ENV["ENVFILE_FILE_NAME"],
- base64_encoded: ENV["ENVFILE_BASE64ENCODE"].present?,
- kms_key_id: ENV["ENVFILE_KMS_KEY_ID"]
- ) do |tempfile|
- Dotenv.load(tempfile.path)
+ def self.load_from_tempfile
+ if ENV["ENABLE_S3_ENVFILE"]
+ Dotenv::S3.load(
+ bucket: ENV["ENVFILE_BUCKET_NAME"],
+ filename: ENV["ENVFILE_FILE_NAME"],
+ base64_encoded: ENV["ENVFILE_BASE64ENCODE"].present?,
+ kms_key_id: ENV["ENVFILE_KMS_KEY_ID"]
+ ) do |tempfile|
+ Dotenv.load(tempfile.path)
+ end
end
end
end
end
end