mirror of
https://github.com/we-promise/sure.git
synced 2026-04-19 03:54:08 +00:00
Add support for dynamic config UI (#256)
* Add support for dynamic config UI
* Add support for section description
* Better dynamic class settings
Added dynamic_fields hash field - Stores all undeclared settings
[] method - Checks declared fields first, then falls back to dynamic hash
[]= method - Updates declared fields normally, stores others in hash
No runtime field declaration - Fields are never dynamically created on the class
* FIX proper lookup for provider keys
- Also validate configurable values properly.
- Change Provider factory to use Rails autoloading (Zeitwerk)
* Fix factory
The derive_adapter_name method relies on string manipulation ("PlaidAccount".sub(/Account$/, "") + "Adapter" → "PlaidAdapter"), but we already have explicit registration in place.
* Make updates atomic, field-aware, and handle blanks explicitly
* Small UX detail
* Add support for PlaidEU in UI also
- This looks like partial support atm
This commit is contained in:
@@ -1,18 +1,15 @@
|
||||
Rails.application.configure do
|
||||
# Initialize Plaid configuration to nil
|
||||
config.plaid = nil
|
||||
config.plaid_eu = nil
|
||||
|
||||
if ENV["PLAID_CLIENT_ID"].present? && ENV["PLAID_SECRET"].present?
|
||||
config.plaid = Plaid::Configuration.new
|
||||
config.plaid.server_index = Plaid::Configuration::Environment[ENV["PLAID_ENV"] || "sandbox"]
|
||||
config.plaid.api_key["PLAID-CLIENT-ID"] = ENV["PLAID_CLIENT_ID"]
|
||||
config.plaid.api_key["PLAID-SECRET"] = ENV["PLAID_SECRET"]
|
||||
end
|
||||
|
||||
if ENV["PLAID_EU_CLIENT_ID"].present? && ENV["PLAID_EU_SECRET"].present?
|
||||
config.plaid_eu = Plaid::Configuration.new
|
||||
config.plaid_eu.server_index = Plaid::Configuration::Environment[ENV["PLAID_ENV"] || "sandbox"]
|
||||
config.plaid_eu.api_key["PLAID-CLIENT-ID"] = ENV["PLAID_EU_CLIENT_ID"]
|
||||
config.plaid_eu.api_key["PLAID-SECRET"] = ENV["PLAID_EU_SECRET"]
|
||||
end
|
||||
end
|
||||
|
||||
# Load Plaid configuration from adapters after initialization
|
||||
Rails.application.config.after_initialize do
|
||||
# Ensure provider adapters are loaded
|
||||
Provider::Factory.ensure_adapters_loaded
|
||||
|
||||
# Reload configurations from settings/ENV
|
||||
Provider::PlaidAdapter.reload_configuration # US region
|
||||
Provider::PlaidEuAdapter.reload_configuration # EU region
|
||||
end
|
||||
|
||||
@@ -76,6 +76,7 @@ Rails.application.routes.draw do
|
||||
resource :llm_usage, only: :show
|
||||
resource :guides, only: :show
|
||||
resource :bank_sync, only: :show, controller: "bank_sync"
|
||||
resource :providers, only: %i[show update]
|
||||
end
|
||||
|
||||
resource :subscription, only: %i[new show create] do
|
||||
|
||||
Reference in New Issue
Block a user