Skip to content

Commit

Permalink
Move endpoint to general group for provision task
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Costanzo <[email protected]>
  • Loading branch information
ianco committed Oct 7, 2020
1 parent c402a60 commit 2a5b635
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 34 deletions.
2 changes: 2 additions & 0 deletions aries_cloudagent/commands/tests/test_provision.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ def test_provision_wallet(self):
"--seed",
test_seed,
"--no-ledger",
"--endpoint",
"test_endpoint",
]
)

Expand Down
65 changes: 33 additions & 32 deletions aries_cloudagent/config/argparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -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="<endpoint>",
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="<profile_endpoint>",
env_var="ACAPY_PROFILE_ENDPOINT",
help="Specifies the profile endpoint for the (public) DID.",
)
parser.add_argument(
"--read-only-ledger",
action="store_true",
Expand All @@ -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:
Expand Down Expand Up @@ -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="<endpoint>",
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="<profile_endpoint>",
env_var="ACAPY_PROFILE_ENDPOINT",
help="Specifies the profile endpoint for the (public) DID.",
)
parser.add_argument(
"-it",
"--inbound-transport",
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions aries_cloudagent/config/tests/test-general-args.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
plugin = foo # ... also a comment

storage-type = bar

endpoint = test_endpoint
2 changes: 0 additions & 2 deletions aries_cloudagent/config/tests/test_argparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ async def test_transport_settings(self):
"http",
"--max-outbound-retry",
"5",
"--endpoint",
"http://0.0.0.0:80",
]
)

Expand Down

0 comments on commit 2a5b635

Please sign in to comment.