Skip to content

Commit 4de76e5

Browse files
committed
Add OSBAPI version to /v3/info
1 parent 36682b3 commit 4de76e5

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

app/controllers/v3/info_controller.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ def v3_info
1616
info.version = config.get(:info, :version) || 0
1717
info.support_address = config.get(:info, :support_address) || ''
1818

19+
osbapi_version_file = Rails.root.join('config', 'osbapi_version').to_s
20+
if File.exist?(osbapi_version_file)
21+
info.osbapi_version = File.read(osbapi_version_file).strip
22+
else
23+
info.osbapi_version = ''
24+
Rails.logger.warn("OSBAPI version file not found at #{osbapi_version_file}")
25+
end
26+
1927
render status: :ok, json: VCAP::CloudController::Presenters::V3::InfoPresenter.new(info)
2028
end
2129

@@ -29,5 +37,5 @@ def show_usage_summary
2937
end
3038

3139
class Info
32-
attr_accessor :build, :min_cli_version, :min_recommended_cli_version, :custom, :description, :name, :version, :support_address
40+
attr_accessor :build, :min_cli_version, :min_recommended_cli_version, :custom, :description, :name, :version, :support_address, :osbapi_version
3341
end

app/presenters/v3/info_presenter.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def to_hash
1515
description: info.description,
1616
name: info.name,
1717
version: info.version,
18+
osbapi_version: info.osbapi_version,
1819
links: {
1920
self: { href: build_self },
2021
support: { href: info.support_address }

0 commit comments

Comments
 (0)