Ends in:
2 DAYS
4 HRS
30 MIN
3 SEC
Ends in:
2 D
4 H
30 M
3 S
Open Closed

General Query: How to store 3rd party service connection URL and API Keys #8404


User avatar
0
Bryan-EDV created

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)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    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

  • User Avatar
    0
    Bryan-EDV created

    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

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    https://abp.io/docs/latest/modules/setting-management#angular-ui

  • User Avatar
    0
    Bryan-EDV created

    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

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Don't use TenantSettingValueProvider , Please use ISettingProvider to get setting value.

    ISettingProvider will try to get from User -> Tenant - Host - Default

  • User Avatar
    0
    Bryan-EDV created

    Thank you.

    Can i check what the difference is with using ISettingProvider and using configuration like so:

    or something like this

  • User Avatar
    0
    Bryan-EDV created

    I've also tried to add the component

    However the settings page still does not show the new tab

    Edit:

    I've also tried adding it in the ngOnInit method

  • User Avatar
    0
    Bryan-EDV created

    end result we want is something like this:

    whereby it can be defined on the host and also the tenant level.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can create a new question for the angular UI part. I will forward to our angular team.

    Thanks.

  • User Avatar
    0
    Bryan-EDV created

    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

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    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?

    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 is true:

    If your setting is not visible to the client. You have to add new API endpoints to get/set, just like

Made with ❤️ on ABP v9.1.0-preview. Updated on December 02, 2024, 12:35