diff --git a/aries_cloudagent/commands/tests/test_provision.py b/aries_cloudagent/commands/tests/test_provision.py index 7cc0a6b2d9..c10a6ba974 100644 --- a/aries_cloudagent/commands/tests/test_provision.py +++ b/aries_cloudagent/commands/tests/test_provision.py @@ -28,6 +28,8 @@ def test_provision_wallet(self): "--seed", test_seed, "--no-ledger", + "--endpoint", + "test_endpoint", ] ) diff --git a/aries_cloudagent/config/argparse.py b/aries_cloudagent/config/argparse.py index 9e24204d26..cf67126cf4 100644 --- a/aries_cloudagent/config/argparse.py +++ b/aries_cloudagent/config/argparse.py @@ -418,6 +418,30 @@ def add_arguments(self, parser: ArgumentParser): and 'indy'. The default (if not specified) is 'indy' if the wallet type\ is set to 'indy', otherwise 'basic'.", ) + parser.add_argument( + "-e", + "--endpoint", + type=str, + nargs="+", + metavar="", + env_var="ACAPY_ENDPOINT", + help="Specifies the endpoints to put into DIDDocs\ + to inform other agents of where they should send messages destined\ + for this agent. Each endpoint could be one of the specified inbound\ + transports for this agent, or the endpoint could be that of\ + another agent (e.g. 'https://example.com/agent-endpoint') if the\ + routing of messages to this agent by a mediator is configured.\ + The first endpoint specified will be used in invitations.\ + The endpoints are used in the formation of a connection\ + with another agent.", + ) + parser.add_argument( + "--profile-endpoint", + type=str, + metavar="", + env_var="ACAPY_PROFILE_ENDPOINT", + help="Specifies the profile endpoint for the (public) DID.", + ) parser.add_argument( "--read-only-ledger", action="store_true", @@ -440,6 +464,15 @@ def get_settings(self, args: Namespace) -> dict: settings["external_plugins"] = args.external_plugins if args.storage_type: settings["storage_type"] = args.storage_type + + if args.endpoint: + settings["default_endpoint"] = args.endpoint[0] + settings["additional_endpoints"] = args.endpoint[1:] + else: + raise ArgsParseError("-e/--endpoint is required") + if args.profile_endpoint: + settings["profile_endpoint"] = args.profile_endpoint + if args.read_only_ledger: settings["read_only_ledger"] = True if args.tails_server_base_url: @@ -733,30 +766,6 @@ class TransportGroup(ArgumentGroup): def add_arguments(self, parser: ArgumentParser): """Add transport-specific command line arguments to the parser.""" - parser.add_argument( - "-e", - "--endpoint", - type=str, - nargs="+", - metavar="", - env_var="ACAPY_ENDPOINT", - help="Specifies the endpoints to put into DIDDocs\ - to inform other agents of where they should send messages destined\ - for this agent. Each endpoint could be one of the specified inbound\ - transports for this agent, or the endpoint could be that of\ - another agent (e.g. 'https://example.com/agent-endpoint') if the\ - routing of messages to this agent by a mediator is configured.\ - The first endpoint specified will be used in invitations.\ - The endpoints are used in the formation of a connection\ - with another agent.", - ) - parser.add_argument( - "--profile-endpoint", - type=str, - metavar="", - env_var="ACAPY_PROFILE_ENDPOINT", - help="Specifies the profile endpoint for the (public) DID.", - ) parser.add_argument( "-it", "--inbound-transport", @@ -834,14 +843,6 @@ def get_settings(self, args: Namespace): raise ArgsParseError("-ot/--outbound-transport is required") settings["transport.enable_undelivered_queue"] = args.enable_undelivered_queue - if args.endpoint: - settings["default_endpoint"] = args.endpoint[0] - settings["additional_endpoints"] = args.endpoint[1:] - else: - raise ArgsParseError("-e/--endpoint is required") - if args.profile_endpoint: - settings["profile_endpoint"] = args.profile_endpoint - if args.label: settings["default_label"] = args.label if args.max_message_size: diff --git a/aries_cloudagent/config/tests/test-general-args.cfg b/aries_cloudagent/config/tests/test-general-args.cfg index c494fc4b24..12d1f32de1 100644 --- a/aries_cloudagent/config/tests/test-general-args.cfg +++ b/aries_cloudagent/config/tests/test-general-args.cfg @@ -3,3 +3,5 @@ plugin = foo # ... also a comment storage-type = bar + +endpoint = test_endpoint diff --git a/aries_cloudagent/config/tests/test_argparse.py b/aries_cloudagent/config/tests/test_argparse.py index b444e65165..7c3c20174a 100644 --- a/aries_cloudagent/config/tests/test_argparse.py +++ b/aries_cloudagent/config/tests/test_argparse.py @@ -42,8 +42,6 @@ async def test_transport_settings(self): "http", "--max-outbound-retry", "5", - "--endpoint", - "http://0.0.0.0:80", ] )