Sha256: da6253d904f158558e77b89dea6424a0037bf2030722beb768ef9029c2df5464

Contents?: true

Size: 518 Bytes

Versions: 4

Compression:

Stored size: 518 Bytes

Contents

require 'active_support'
require 'dotenv'

module Gris
  class << self
    def load_environment
      env_file = Gris.env.test? ? '.env.test' : '.env'
      Dotenv.overload env_file
    end

    def env
      @_env ||= ActiveSupport::StringInquirer.new(ENV['RACK_ENV'] || 'development')
    end

    def env=(environment)
      @_env = ActiveSupport::StringInquirer.new(environment)
    end

    def db_connection_details
      YAML.load(ERB.new(File.read('./config/database.yml')).result)[Gris.env]
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gris-0.2.1 lib/gris/setup.rb
gris-0.2.0 lib/gris/setup.rb
gris-0.1.7 lib/gris/setup.rb
gris-0.1.6 lib/gris/setup.rb