From afddec61145a4f2d0ad515ec457e228004f55185 Mon Sep 17 00:00:00 2001 From: Shaanjot Gill Date: Mon, 19 Jun 2023 11:20:45 -0700 Subject: [PATCH] extra_settings dict field update Signed-off-by: Shaanjot Gill --- Multitenancy.md | 10 ++++----- aries_cloudagent/multitenant/admin/routes.py | 23 +++++--------------- 2 files changed, 9 insertions(+), 24 deletions(-) diff --git a/Multitenancy.md b/Multitenancy.md index 0284767eb9..c6d5fb87c3 100644 --- a/Multitenancy.md +++ b/Multitenancy.md @@ -416,8 +416,8 @@ To allow configurablity of ACA-Py startup parameters/environment variables at a "wallet_dispatch_type": "base", "extra_settings": { "ACAPY_LOG_LEVEL": "INFO", - "ACAPY_INVITE_PUBLIC": "true", - "ACAPY_PUBLIC_INVITES": "True", + "ACAPY_INVITE_PUBLIC": true, + "ACAPY_PUBLIC_INVITES": true }, } ``` @@ -442,8 +442,8 @@ To allow configurablity of ACA-Py startup parameters/environment variables at a "image_url": " ... ", "extra_settings": { "ACAPY_LOG_LEVEL": "INFO", - "ACAPY_INVITE_PUBLIC": "True", - "ACAPY_PUBLIC_INVITES": "false", + "ACAPY_INVITE_PUBLIC": true, + "ACAPY_PUBLIC_INVITES": false }, } ``` @@ -454,5 +454,3 @@ To allow configurablity of ACA-Py startup parameters/environment variables at a -H "x-api-key: $ACAPY_ADMIN_URL_API_KEY" \ -d @- ``` - -All the currently suppoorted settings in `extra_settings` are either accepting str or boolean. But the bool attributes in the request body should be passed along as a string such as `"true", "True", "false", "False"`. diff --git a/aries_cloudagent/multitenant/admin/routes.py b/aries_cloudagent/multitenant/admin/routes.py index faa38efee6..eae4c64e8e 100644 --- a/aries_cloudagent/multitenant/admin/routes.py +++ b/aries_cloudagent/multitenant/admin/routes.py @@ -9,7 +9,6 @@ response_schema, ) from marshmallow import ValidationError, fields, validate, validates_schema -from typing import Union from ...admin.request_context import AdminRequestContext from ...core.error import BaseError @@ -62,16 +61,6 @@ def format_wallet_record(wallet_record: WalletRecord): return wallet_info -def process_bool_label(label: str) -> Union[bool, str]: - """Return processed extra settings dict value.""" - if label == "True" or label == "true": - return True - elif label == "False" or label == "false": - return False - else: - return label - - def get_extra_settings_dict_per_tenant(tenant_settings: dict) -> dict: """Get per tenant settings to be applied when creating wallet.""" @@ -91,7 +80,7 @@ def get_extra_settings_dict_per_tenant(tenant_settings: dict) -> dict: continue if flag != "ACAPY_ENDORSER_ROLE": map_flag = ACAPY_LIFECYCLE_CONFIG_FLAG_MAP[flag] - extra_settings[map_flag] = process_bool_label(tenant_settings[flag]) + extra_settings[map_flag] = tenant_settings[flag] return extra_settings @@ -117,9 +106,8 @@ class CreateWalletRequestSchema(OpenAPISchema): ) extra_settings = fields.Dict( - keys=fields.Str(description="Agent Config Flag"), - values=fields.Str(description="Parameter"), - allow_none=True, + description="Agent config key-value pairs", + required=False, ) wallet_key_derivation = fields.Str( @@ -209,9 +197,8 @@ class UpdateWalletRequestSchema(OpenAPISchema): validate=validate.OneOf(["default", "both", "base"]), ) extra_settings = fields.Dict( - keys=fields.Str(description="Agent Config Flag"), - values=fields.Str(description="Parameter"), - allow_none=True, + description="Agent config key-value pairs", + required=False, ) wallet_webhook_urls = fields.List( fields.Str(