Business requirement: We need to connect to 3rd party services (OpenAI) via connection sting and API key. Each tenant would have their own connection sting and API key. However if not defined on the tenant level, we need to fallback to a host-defined connection string and API key.
Question: Would settings module be suitable for handling this use case or would it be better add new columns to the SaasTenant table to track the connection string and API keys? We need the API keys to be encrypted if it is being stored in the Database. Would need your support on the optimal solution for this requirement
Thank you
11 Answer(s)
-
0
hi
You can define a setting for the tenant and host levels, and the setting value supports encryption.
IsEncrypted: A boolean value indicates that whether this setting value should be encrypted on save and decrypted on read. It makes possible to secure the setting value in the database.
https://abp.io/docs/latest/framework/infrastructure/settings?_redirected=B8ABF606AA1BDF5C629883DF1061649A#defining-settings
https://github.com/abpframework/abp/blob/dev/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/TenantSettingManagerExtensions.cs#L11-L49
-
0
How can we have these settings configurable form the UI (Angular)?
I would like to be able to log in as a tenant admin and configure the URL and API key for the 3rd party service in the UI
I know ABP has a settings page but was not able to find the documentation for updating the UI page for new properties
-
0
hi
https://abp.io/docs/latest/modules/setting-management#angular-ui
-
0
Hi,
When using the TenantSettingValueProvider to retrieve the setting, is it possible to get a value for the host as well? for example, if the value is null for the tenant i want to fallback to the value from the host level
-
0
hi
Don't use
TenantSettingValueProvider
, Please useISettingProvider
to get setting value.ISettingProvider
will try to get fromUser -> Tenant - Host - Default
-
0
-
0
-
0
-
0
hi
You can create a new question for the angular UI part. I will forward to our angular team.
Thanks.
-
0
Okay will pick up on the UI part later on
For the settings defined in the BE, how do we retrieve the values and avaialble settings?
e.g assuming I create the Llm.Url setting, how would my frontend be able to know that there is such a setting "Llm.Url" and retrieve its value? In the swagger UI it seems like there is no api for the user-defined settings names / values
-
0
hi
assuming I create the
Llm.Url
setting, how would my frontend be able to know that there is such a settingLlm.Url
and retrieve its value?You should hardcode the setting name in angular to get values.
https://abp.io/docs/latest/framework/ui/angular/settings#how-to-get-a-specific-setting This requires the
IsVisibleToClients(A boolean value indicates that whether this setting value is available in the client side or not. Default value is false to prevent accidently publishing an internal critical setting value.)
of your setting definition istrue
:If your setting is not visible to the client. You have to add new API endpoints to
get/set
, just like