class Virtuaservices::Utils::Plugins::Heroku
Public Class Methods
load!(instance)
click to toggle source
Loads the heroku informations inside the data of the instance. @param instance [Virtuaservices::Monitoring::Instance] the instance to put the enrichment inside.
# File lib/virtuaservices/utils/loaders/heroku.rb, line 7 def self.load!(instance) if !ENV['OAUTH_TOKEN'].nil? && instance != false && instance.persisted? heroku = PlatformAPI.connect_oauth(ENV['OAUTH_TOKEN']) regex = /\Ahttps?:\/\/([a-z\-]+).herokuapp.com\/?\z/ if instance.url.match(regex) app_name = instance.url.scan(regex).first.first instance.update_attribute(:data, heroku.app.info(app_name)) end end end