Sha256: 597846a577175ed57e95f7516b0ce5464e0aae9169f149f805c24443f8cf7dbe

Contents?: true

Size: 683 Bytes

Versions: 1

Compression:

Stored size: 683 Bytes

Contents

require 'dotenv'
require 'rbconfig'

module Dotenv
  module Beefy
    class Railtie < Rails::Railtie
      config.before_configuration { load_environments }

      def load_environments
        files = environments.map { |env| ".env.#{env}" }
        files << '.env'
        Dotenv.load(*files)
      end

      def environments
        [
          'local',
          Rails.env,
          host_family
        ]
      end

      def host_family
        case ::RbConfig::CONFIG['host_os']
         when /(darwin|mac os)/i
           'darwin'
         when /(linux|bsd|aix|solaris)/i
           'nix'
         when /cygwin/i
           'cygwin'
         end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dotenv-beefy-0.1.0 lib/dotenv/beefy/railtie.rb