Make base_uri dinamically configurable

Created on 24 July 2023, over 1 year ago
Updated 5 September 2023, about 1 year ago

Problem/Motivation

First of all, grazie for the module :)
I am trying to use it (together with ECA to launch the requests with dynamic user/business logic configuration) to query blockchain networks.
As you may know, their "peculiarity" is that, being distributed ledgers, they are maintained by multiple nodes, hence they have common API/RPC paths, but variable base urls (for each "validator" node).
I'm not an expert developer but reading from the related (closed) issue and seeing /admin/config/services/http-client-manager/settings, it seems to me this is still not possible.

My example use case would require selecting the base_uri from a list of "protocols" and their "providers" (that may be imported or user-generated taxonomy terms) together with the query arguments when calling the action plugin from ECA, and I think this would be very common and bring many users from Web3 to Drupal and this module.
I am available on slack for further discussion/clarification/planning :) Thank you.

Feature request
Status

Fixed

Version

9.3

Component

Code

Created by

🇮🇹Italy kopeboy Milan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @kopeboy
  • 🇮🇹Italy kopeboy Milan

    Further clarification:
    The list of available/preferred hosts (base_uri) are all safe in this usecase as the database to be queried is already public and shared.

    Furthermore, the list changes over time, so it would be unpractical to maintain it has a fixed config yml rather than Drupal content that itself can be updated from an API (in case of public, active validators) or entered by the "providers" themselves (in case of business/partner nodes).

    Dinamically selecting the base_uri would also help load balancing the public infrastructure and avoiding possible rate limits.

    If this feature is too difficult to implement in this module, where would you suggest I look into? 🙏🏻

  • 🇮🇹Italy kopeboy Milan

    Idea & question:
    I could set up redirects from the configured base url (keeping the path) to the different available sources (and rotate them with some business logic for load balancing). Would requests managed by this module still work and provide the result back to the action plugin?

  • 🇮🇹Italy aronne

    Hi @kopeboy

    I'm not an expert developer but reading from the related (closed) issue and seeing /admin/config/services/http-client-manager/settings, it seems to me this is still not possible.

    Yes you actually can. I'm gonna upload a couple screenshots for you to see how to do it.


    Alternatively please take a look at this patch and let me know if using tokens could be a solutions for you: Allow using tokens as base_uri value Fixed

    Regards,
    aronne

  • 🇮🇹Italy kopeboy Milan

    Yes, I had seen that option, but that was a manual, static, override.
    Now that you fixed the linked issue, allowing token substitution, it seems I have a working solution :)
    I'll test soon and let you know, thanks! 🙏🏻

  • Status changed to Fixed about 1 year ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024