Skip to content

Commit 6199dd8

Browse files
authored
Merge pull request openwallet-foundation#1802 from shaangill025/issue#1791
Fix: Inbound Transport is_external attribute
2 parents 722dc41 + e837b65 commit 6199dd8

4 files changed

Lines changed: 39 additions & 30 deletions

File tree

aries_cloudagent/config/logging.py

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -113,47 +113,53 @@ def print_banner(
113113

114114
# Inbound transports
115115
banner.print_subtitle("Inbound Transports")
116-
banner.print_spacer()
117-
banner.print_list(
118-
[
119-
f"{transport.scheme}://{transport.host}:{transport.port}"
120-
for transport in inbound_transports.values()
121-
]
122-
)
123-
banner.print_spacer()
124-
125-
external_in_transports = set().union(
126-
*(
127-
transport
128-
for transport in inbound_transports.values()
129-
if transport.is_external
130-
)
131-
)
116+
internal_in_transports = [
117+
f"{transport.scheme}://{transport.host}:{transport.port}"
118+
for transport in inbound_transports.values()
119+
if not transport.is_external
120+
]
121+
if internal_in_transports:
122+
banner.print_spacer()
123+
banner.print_list(internal_in_transports)
124+
banner.print_spacer()
125+
external_in_transports = [
126+
f"{transport.scheme}://{transport.host}:{transport.port}"
127+
for transport in inbound_transports.values()
128+
if transport.is_external
129+
]
132130
if external_in_transports:
133131
banner.print_spacer()
134-
banner.print_list([f"{external_in_transports}"])
132+
banner.print_subtitle(" External Plugin")
133+
banner.print_spacer()
134+
banner.print_list(external_in_transports)
135135
banner.print_spacer()
136136

137137
# Outbound transports
138-
schemes = set().union(
139-
*(transport.schemes for transport in outbound_transports.values())
138+
banner.print_subtitle("Outbound Transports")
139+
internal_schemes = set().union(
140+
*(
141+
transport.schemes
142+
for transport in outbound_transports.values()
143+
if not transport.is_external
144+
)
140145
)
141-
if schemes:
142-
banner.print_subtitle("Outbound Transports")
146+
if internal_schemes:
143147
banner.print_spacer()
144-
banner.print_list([f"{scheme}" for scheme in sorted(schemes)])
148+
banner.print_list([f"{scheme}" for scheme in sorted(internal_schemes)])
145149
banner.print_spacer()
146150

147-
external_out_transports = set().union(
151+
external_schemes = set().union(
148152
*(
149-
transport
153+
transport.schemes
150154
for transport in outbound_transports.values()
151155
if transport.is_external
152156
)
153157
)
154-
if external_out_transports:
158+
if external_schemes:
159+
banner.print_spacer()
160+
banner.print_subtitle(" External Plugin")
155161
banner.print_spacer()
156-
banner.print_list([f"{external_out_transports}"])
162+
banner.print_list([f"{scheme}" for scheme in sorted(external_schemes)])
157163
banner.print_spacer()
158164

159165
# DID info

aries_cloudagent/transport/inbound/base.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def __init__(
1919
create_session: Callable,
2020
*,
2121
max_message_size: int = 0,
22+
is_external: bool = False,
2223
wire_format: BaseWireFormat = None,
2324
root_profile: Profile = None,
2425
):
@@ -35,6 +36,7 @@ def __init__(
3536
self._scheme = scheme
3637
self.wire_format: BaseWireFormat = wire_format
3738
self.root_profile: Profile = root_profile
39+
self._is_external = is_external
3840

3941
@property
4042
def max_message_size(self):
@@ -46,6 +48,11 @@ def scheme(self):
4648
"""Accessor for this transport's scheme."""
4749
return self._scheme
4850

51+
@property
52+
def is_external(self):
53+
"""Accessor for this transport's is_external."""
54+
return self._is_external
55+
4956
def create_session(
5057
self,
5158
*,

aries_cloudagent/transport/inbound/http.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
class HttpTransport(BaseInboundTransport):
1616
"""Http Transport class."""
1717

18-
is_external = False
19-
2018
def __init__(self, host: str, port: int, create_session, **kwargs) -> None:
2119
"""
2220
Initialize an inbound HTTP transport instance.

aries_cloudagent/transport/inbound/ws.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
class WsTransport(BaseInboundTransport):
1717
"""Websockets Transport class."""
1818

19-
is_external = False
20-
2119
def __init__(self, host: str, port: int, create_session, **kwargs) -> None:
2220
"""
2321
Initialize an inbound WebSocket transport instance.

0 commit comments

Comments
 (0)