From e8d2604ec3e466856f64f20c42b03829d7cff996 Mon Sep 17 00:00:00 2001 From: Konstantin Haase Date: Sun, 23 Sep 2012 01:43:51 +0200 Subject: [PATCH] add config endpoint --- lib/travis/api/app/endpoint/home.rb | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/lib/travis/api/app/endpoint/home.rb b/lib/travis/api/app/endpoint/home.rb index 8f41c586..120c5244 100644 --- a/lib/travis/api/app/endpoint/home.rb +++ b/lib/travis/api/app/endpoint/home.rb @@ -3,7 +3,12 @@ require 'travis/api/app' class Travis::Api::App class Endpoint class Home < Endpoint - set(:prefix, '/') + set :prefix, '/' + set :client_config, + host: Travis.config.host, + shorten_host: Travis.config.shorten_host, + assets: Travis.config.assets, + pusher: { key: Travis.config.pusher.try(:key) } # Landing point. Redirects web browsers to [API documentation](#/docs/). get '/' do @@ -22,6 +27,24 @@ class Travis::Api::App halt 400 unless params[:to] =~ %r{^https?://} redirect params[:to] end + + # Provides you with system info: + # + # { + # config: { + # host: "travis-ci.org", + # shorten_host: "trvs.io", + # pusher: { key: "dd3f11c013317df48b50" }, + # assets: { + # host: "localhost:3000", + # version: "asset-id", + # interval: 15 + # } + # } + # } + get '/config' do + { config: settings.client_config } + end end end end