Sha256: 52acc0beb731bb653b8927a9149f9cc5dac4337fd37fd42bc9c5168b0f981ffd

Contents?: true

Size: 777 Bytes

Versions: 1

Compression:

Stored size: 777 Bytes

Contents

module Vault
  module Config
    extend self

    def remote_env(app, env)
      heroku = Heroku::API.new
      heroku.get_config_vars(app).body[env]
    end

    def core_follower_url
      remote_env('vault-core-follower', 'DATABASE_URL')
    end

    def env(key)
      ENV[key]
    end

    def env!(key)
      env(key) || raise("missing #{key}")
    end

    def production?
      env('RACK_ENV') == 'production'
    end

    def test?
      env('RACK_ENV') == 'test'
    end

    def app_name
      env("APP_NAME")
    end

    def port
      env!("PORT").to_i
    end

    def database_url(kind = '')
      kind = "#{kind}_".upcase unless kind.empty?
      env!("#{kind}DATABASE_URL")
    end

    def enable_ssl?
      !env('VAULT_TOOLS_DISABLE_SSL')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vault-tools-0.3.2 lib/vault-tools/config.rb