Sha256: 30adc3db9972f1226a0ae4fdeed730dd8bd29b082a87997bc423a7fb78e5b6f2

Contents?: true

Size: 338 Bytes

Versions: 18

Compression:

Stored size: 338 Bytes

Contents

# frozen_string_literal: true

class CloudGovConfig
  ENV_VARIABLE = "VCAP_SERVICES"

  def self.dig(*path)
    return nil if ENV[ENV_VARIABLE].blank?
    first, *rest = path
    vcap_services[first]&.first&.dig(*rest)
  end

  def self.vcap_services
    @vcap_services ||= JSON.parse(ENV[ENV_VARIABLE]).with_indifferent_access
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
rails_template_18f-2.0.0 lib/generators/rails_template18f/cloud_gov_config/templates/app/models/cloud_gov_config.rb
rails_template_18f-1.3.0 lib/generators/rails_template18f/cloud_gov_config/templates/app/models/cloud_gov_config.rb
rails_template_18f-1.2.0 lib/generators/rails_template18f/cloud_gov_config/templates/app/models/cloud_gov_config.rb
rails_template_18f-1.1.0 lib/generators/rails_template18f/cloud_gov_config/templates/app/models/cloud_gov_config.rb
rails_template_18f-1.0.0 lib/generators/rails_template18f/cloud_gov_config/templates/app/models/cloud_gov_config.rb
rails_template_18f-0.8.2 lib/generators/rails_template18f/cloud_gov_config/templates/app/models/cloud_gov_config.rb
rails_template_18f-0.8.1 lib/generators/rails_template18f/cloud_gov_config/templates/app/models/cloud_gov_config.rb
rails_template_18f-0.8.0 lib/generators/rails_template18f/cloud_gov_config/templates/app/models/cloud_gov_config.rb
rails_template_18f-0.7.2 lib/generators/rails_template18f/cloud_gov_config/templates/app/models/cloud_gov_config.rb
rails_template_18f-0.7.1 lib/generators/rails_template18f/cloud_gov_config/templates/app/models/cloud_gov_config.rb
rails_template_18f-0.7.0 lib/generators/rails_template18f/cloud_gov_config/templates/app/models/cloud_gov_config.rb
rails_template_18f-0.6.0 lib/generators/rails_template18f/cloud_gov_config/templates/app/models/cloud_gov_config.rb
rails_template_18f-0.5.3 lib/generators/rails_template18f/cloud_gov_config/templates/app/models/cloud_gov_config.rb
rails_template_18f-0.5.2 lib/generators/rails_template18f/cloud_gov_config/templates/app/models/cloud_gov_config.rb
rails_template_18f-0.5.1 lib/generators/rails_template18f/cloud_gov_config/templates/app/models/cloud_gov_config.rb
rails_template_18f-0.5.0 lib/generators/rails_template18f/cloud_gov_config/templates/app/models/cloud_gov_config.rb
rails_template_18f-0.4.1 lib/generators/rails_template18f/cloud_gov_config/templates/app/models/cloud_gov_config.rb
rails_template_18f-0.4.0 lib/generators/rails_template18f/cloud_gov_config/templates/app/models/cloud_gov_config.rb