lib/middleman-dotenv/extension.rb in middleman-dotenv-0.0.1 vs lib/middleman-dotenv/extension.rb in middleman-dotenv-0.0.2
- old
+ new
@@ -1,14 +1,15 @@
module Middleman
module Dotenv
class << self
def registered(app, options_hash={})
- require 'dotenv'
- ::Dotenv.load File.join(Dir.pwd, ".env")
+ env = options_hash[:env] || '.env'
+ require 'dotenv' unless defined?(::Dotenv)
+ ::Dotenv.load File.join(Dir.pwd, env)
app.before do
- ::Dotenv.load File.join(self.class.inst.root, ".env")
+ ::Dotenv.load File.join(self.class.inst.root, env)
end
end
alias :included :registered
end
end
-end
\ No newline at end of file
+end