Skip to content
This repository was archived by the owner on Jun 2, 2021. It is now read-only.

Commit 77af3f1

Browse files
v3: refactor domain protocols to a model method
Previously this was implemented on the presenter. This commit moves the method to the domain model object to be more accessible. [#172512289] Co-authored-by: Sarah Weinstein <sweinstein@pivotal.io> Co-authored-by: Belinda Liu <bliu@pivotal.io>
1 parent 923e852 commit 77af3f1

2 files changed

Lines changed: 17 additions & 7 deletions

File tree

app/models/runtime/domain.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,16 @@ def in_suspended_org?
143143
false
144144
end
145145

146+
def protocols
147+
return ['http'] if self.private?
148+
149+
# If Kubernetes is enabled that implies that we are using istio, not the routing API
150+
k8s_enabled = !!Config.config.get(:kubernetes, :host_url)
151+
return ['tcp'] if !k8s_enabled && self.router_group_guid
152+
153+
['http']
154+
end
155+
146156
private
147157

148158
def validate_change_owning_organization(organization)

app/presenters/v3/domain_presenter.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def to_hash
2424
name: domain.name,
2525
internal: domain.internal,
2626
router_group: hashified_router_group(domain.router_group_guid),
27-
supported_protocols: protocols,
27+
supported_protocols: domain.protocols,
2828
metadata: {
2929
labels: hashified_labels(domain.labels),
3030
annotations: hashified_annotations(domain.annotations),
@@ -59,13 +59,13 @@ def domain
5959
@resource
6060
end
6161

62-
def protocols
63-
# If Kubernetes is enabled that implies that we are using istio
64-
k8s_enabled = !VCAP::CloudController::Config.config.get(:kubernetes, :host_url).blank?
65-
return ['tcp'] if !k8s_enabled && domain.router_group_guid
62+
# def protocols
63+
# # If Kubernetes is enabled that implies that we are using istio
64+
# k8s_enabled = !VCAP::CloudController::Config.config.get(:kubernetes, :host_url).blank?
65+
# return ['tcp'] if !k8s_enabled && domain.router_group_guid
6666

67-
return ['http']
68-
end
67+
# return ['http']
68+
# end
6969

7070
def hashified_router_group(router_group_guid)
7171
router_group_guid ? { guid: router_group_guid } : nil

0 commit comments

Comments
 (0)