Repository: hyperledger/aries-cloudagent-python

Issue:
Allow Configuration Settings on a per-tenant basis
- resolve #2209
- Some changes related to getting `BaseLedger` instance from `ledger_id` won't be used right now but will be used soon with some proposed Traction features.


Discussion:
Thanks, @shaangill025 — let us know about the test failures and we’ll look at moving this forward.
@swcurran I have added the documentation, this PR is ready for review.
The goal was to get this into 0.8.2, but since the developer has not been available to work on this, it may not make it.
@usingtechnology The requested changes have been added.
@shaangill025 - I would expect the tenant `/settings` API to update/return the small set of values not ALL of the settings. I realize your logic will only update the given set, but the API itself should NOT return all the settings. There are definitely things in there a tenant should not know. Can we limit to the set you provided? Also, I don't think those changes are persistent over server restarts. It doesn't appear that we are reading or writing from the wallet record (where the extra settings are initially stored).

Also, sorry if I wasn't really clear. The config/arg_parse is pretty confusing. That secondary mapping I was thinking about would match what someone puts into config.yml, so it's generally the dash separated key. Like `log-level`, `auto-ping-connection`, `auto-accept-invites`. 
Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=hyperledger_aries-cloudagent-python&pullRequest=2233)

[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=hyperledger_aries-cloudagent-python&pullRequest=2233&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=hyperledger_aries-cloudagent-python&pullRequest=2233&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=hyperledger_aries-cloudagent-python&pullRequest=2233&resolved=false&types=BUG)  
[![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=hyperledger_aries-cloudagent-python&pullRequest=2233&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=hyperledger_aries-cloudagent-python&pullRequest=2233&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=hyperledger_aries-cloudagent-python&pullRequest=2233&resolved=false&types=VULNERABILITY)  
[![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=hyperledger_aries-cloudagent-python&pullRequest=2233&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=hyperledger_aries-cloudagent-python&pullRequest=2233&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=hyperledger_aries-cloudagent-python&pullRequest=2233&resolved=false&types=SECURITY_HOTSPOT)  
[![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=hyperledger_aries-cloudagent-python&pullRequest=2233&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=hyperledger_aries-cloudagent-python&pullRequest=2233&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=hyperledger_aries-cloudagent-python&pullRequest=2233&resolved=false&types=CODE_SMELL)

[![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=hyperledger_aries-cloudagent-python&pullRequest=2233) No Coverage information  
[![No Duplication information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/NoDuplicationInfo-16px.png 'No Duplication information')](https://sonarcloud.io/component_measures?id=hyperledger_aries-cloudagent-python&pullRequest=2233) No Duplication information



Resolving patch:
diff --git a/aries_cloudagent/multitenant/admin/routes.py b/aries_cloudagent/multitenant/admin/routes.py
--- a/aries_cloudagent/multitenant/admin/routes.py
+++ b/aries_cloudagent/multitenant/admin/routes.py
@@ -88,7 +88,7 @@ def get_extra_settings_dict_per_tenant(tenant_settings: dict) -> dict:
 
     endorser_role_flag = tenant_settings.get(
         "ACAPY_ENDORSER_ROLE"
-    ) or tenant_settings.get("endorser_protocol_role")
+    ) or tenant_settings.get("endorser-protocol-role")
     extra_settings = {}
     if endorser_role_flag and endorser_role_flag == "author":
         extra_settings["endorser.author"] = True
@@ -102,7 +102,7 @@ def get_extra_settings_dict_per_tenant(tenant_settings: dict) -> dict:
             # These flags require endorser role as author, if not set as author then
             # this setting will be ignored.
             continue
-        if flag != "ACAPY_ENDORSER_ROLE":
+        if flag != "ACAPY_ENDORSER_ROLE" and flag != "endorser-protocol-role":
             map_flag = ACAPY_LIFECYCLE_CONFIG_FLAG_MAP.get(
                 flag
             ) or ACAPY_LIFECYCLE_CONFIG_FLAG_ARGS_MAP.get(flag)
diff --git a/aries_cloudagent/settings/routes.py b/aries_cloudagent/settings/routes.py
--- a/aries_cloudagent/settings/routes.py
+++ b/aries_cloudagent/settings/routes.py
@@ -49,6 +49,8 @@ class ProfileSettingsSchema(OpenAPISchema):
 def _get_filtered_settings_dict(wallet_settings: dict):
     """Get filtered settings dict to display."""
     filter_param_list = list(ACAPY_LIFECYCLE_CONFIG_FLAG_ARGS_MAP.values())
+    filter_param_list.append("endorser.author")
+    filter_param_list.append("endorser.endorser")
     settings_dict = {}
     for param in filter_param_list:
         if param in wallet_settings:


Test patch: