Skip to content

Instantly share code, notes, and snippets.

@portertech
Created July 14, 2016 00:38
Show Gist options
  • Save portertech/77ecd66f88925d163576c9da593a0013 to your computer and use it in GitHub Desktop.
Save portertech/77ecd66f88925d163576c9da593a0013 to your computer and use it in GitHub Desktop.
def api_settings
case
when ENV['SENSU_API_URL']
uri = URI(ENV['SENSU_API_URL'])
@api_settings = {
'host' => uri.host,
'port' => uri.port,
'user' => uri.user,
'password' => uri.password
}
else
@api_settings = settings['api'] || {}
@api_settings['host'] ||= '127.0.0.1'
@api_settings['port'] ||= 4567
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment