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
23 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 -
0
https://abp.io/docs/latest/framework/ui/angular/settings#how-to-get-a-specific-setting
Thanks, I will use the above link to get a value from the backend. Is there also a way to set a value using the this.config? Thanks
-
0
hi
Add a new api endpoint to change the setting value.
-
0
Hi
I noted that setting provider does not have setter methods (https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/ISettingProvider.cs)
What service can i use to set the values of the setting? Thank you
-
0
-
0
Hi
Are you able to point me to the source code for controller method for settings/oauth? I assume inside the controller method it would call some service like settingsProvider.setAsync('Llm.Url', newValue) but i might be mistaken
-
0
-
0
-
0
hi
SetGlobalAsync -> will set for host level?
Yes, the provider name will be
G
(global)Then SetForTenantAsync / SetForCurrentTenantAsync -> will set for tenant level?
Yes, the provider name will be
T
(Tenant) and provider key will be current tenant id or the tenant id that your provider. -
0
Thank you,
Meaning that G provider will apply to all tenants unless overwritten on a T level
-
0
You're right.
User => Tenant => Global => Default
-
0
Thanks so much. I think i've got all the info i need now. as mentioend earlier, we'll raise another ticket on the angular support https://abp.io/qa/questions/8404/3a169e3e-9f81-d082-1017-310a3927bd1e or if you could help get any details on that would be great
-
0
hi
Our angular team will check your question.
Thanks.