@@ -75,10 +75,8 @@ def create_argument_parser(*, prog: str = None):
7575
7676def load_argument_groups (parser : ArgumentParser , * groups : Type [ArgumentGroup ]):
7777 """Log a set of argument groups into a parser.
78-
7978 Returns:
8079 A callable to convert loaded arguments into a settings dictionary
81-
8280 """
8381 group_inst = []
8482 for group in groups :
@@ -872,32 +870,56 @@ def get_settings(self, args: Namespace) -> dict:
872870 if args .no_ledger :
873871 settings ["ledger.disabled" ] = True
874872 else :
875- configured = False
873+ single_configured = False
874+ multi_configured = False
875+ update_pool_name = False
876876 if args .genesis_url :
877877 settings ["ledger.genesis_url" ] = args .genesis_url
878- configured = True
878+ single_configured = True
879879 elif args .genesis_file :
880880 settings ["ledger.genesis_file" ] = args .genesis_file
881- configured = True
881+ single_configured = True
882882 elif args .genesis_transactions :
883883 settings ["ledger.genesis_transactions" ] = args .genesis_transactions
884- configured = True
884+ single_configured = True
885885 if args .genesis_transactions_list :
886886 with open (args .genesis_transactions_list , "r" ) as stream :
887887 txn_config_list = yaml .safe_load (stream )
888888 ledger_config_list = []
889889 for txn_config in txn_config_list :
890890 ledger_config_list .append (txn_config )
891+ if "is_write" in txn_config and txn_config ["is_write" ]:
892+ if "genesis_url" in txn_config :
893+ settings ["ledger.genesis_url" ] = txn_config [
894+ "genesis_url"
895+ ]
896+ elif "genesis_file" in txn_config :
897+ settings ["ledger.genesis_file" ] = txn_config [
898+ "genesis_file"
899+ ]
900+ elif "genesis_transactions" in txn_config :
901+ settings ["ledger.genesis_transactions" ] = txn_config [
902+ "genesis_transactions"
903+ ]
904+ else :
905+ raise ArgsParseError (
906+ "No genesis information provided for write ledger"
907+ )
908+ if "id" in txn_config :
909+ settings ["ledger.pool_name" ] = txn_config ["id" ]
910+ update_pool_name = True
891911 settings ["ledger.ledger_config_list" ] = ledger_config_list
892- configured = True
893- if not configured :
912+ multi_configured = True
913+ if not ( single_configured or multi_configured ) :
894914 raise ArgsParseError (
895915 "One of --genesis-url --genesis-file, --genesis-transactions "
896916 "or --genesis-transactions-list must be specified (unless "
897917 "--no-ledger is specified to explicitly configure aca-py to"
898918 " run with no ledger)."
899919 )
900- if args .ledger_pool_name :
920+ if single_configured and multi_configured :
921+ raise ArgsParseError ("Cannot configure both single- and multi-ledger." )
922+ if args .ledger_pool_name and not update_pool_name :
901923 settings ["ledger.pool_name" ] = args .ledger_pool_name
902924 if args .ledger_keepalive :
903925 settings ["ledger.keepalive" ] = args .ledger_keepalive
@@ -1327,7 +1349,6 @@ def get_settings(self, args: Namespace):
13271349class MediationInviteGroup (ArgumentGroup ):
13281350 """
13291351 Mediation invitation settings.
1330-
13311352 These can be provided at provision- and start-time.
13321353 """
13331354
0 commit comments