add config endpoint
This commit is contained in:
parent
70e5414b87
commit
e8d2604ec3
|
@ -3,7 +3,12 @@ require 'travis/api/app'
|
||||||
class Travis::Api::App
|
class Travis::Api::App
|
||||||
class Endpoint
|
class Endpoint
|
||||||
class Home < 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/).
|
# Landing point. Redirects web browsers to [API documentation](#/docs/).
|
||||||
get '/' do
|
get '/' do
|
||||||
|
@ -22,6 +27,24 @@ class Travis::Api::App
|
||||||
halt 400 unless params[:to] =~ %r{^https?://}
|
halt 400 unless params[:to] =~ %r{^https?://}
|
||||||
redirect params[:to]
|
redirect params[:to]
|
||||||
end
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user