Sha256: 06ac82145fd766552653002c6e30969b3b79270ab1c7c3b33da0fb84fdfbb695

Contents?: true

Size: 490 Bytes

Versions: 11

Compression:

Stored size: 490 Bytes

Contents

module Tako
  class Config
    class << self
      def shards_yml
        YAML.load(ERB.new(File.read(yml_path)).result).with_indifferent_access
      end

      def env
        defined?(::Rails.env) ? Rails.env : (ENV['RAILS_ENV'] || :default)
      end

      private

      def yml_path
        File.join(directory, ENV['TAKO_CONFIG_FILE_PATH'] || "config/shards.yml")
      end

      def directory
        defined?(::Rails.root) ? Rails.root.to_s : Dir.pwd
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
tako-0.6.0 lib/tako/config.rb
tako-0.5.0 lib/tako/config.rb
tako-0.4.1 lib/tako/config.rb
tako-0.4.0 lib/tako/config.rb
tako-0.3.2 lib/tako/config.rb
tako-0.3.1 lib/tako/config.rb
tako-0.3.0 lib/tako/config.rb
tako-0.2.2 lib/tako/config.rb
tako-0.2.1 lib/tako/config.rb
tako-0.2.0 lib/tako/config.rb
tako-0.1.0 lib/tako/config.rb