View Source Buckets.Cloud.Dynamic (Buckets v1.0.0-rc.3)
Dynamic configuration management for Cloud modules.
This module provides functions for managing runtime configuration changes, allowing Cloud modules to switch between different adapters and configurations on a per-process basis, similar to Ecto's dynamic repository functionality.
Usage
These functions are automatically available on Cloud modules that use
Buckets.Cloud
. You typically don't need to call this module directly.
Process-Local Configuration
MyApp.Cloud.put_dynamic_config([
adapter: Buckets.Adapters.GCS,
bucket: "tenant-bucket",
service_account_credentials: credentials
])
Scoped Configuration
MyApp.Cloud.with_config(config, fn ->
MyApp.Cloud.insert("file.pdf")
end)
Auth Server Management
For adapters that need background processes (like GCS auth servers), these
are automatically started and cached per-process as needed through the
adapter's prepare_dynamic_config/1
callback.
Summary
Functions
Gets the current configuration for the given cloud module.
Sets dynamic configuration for the current process.
Executes a function with a specific configuration.
Functions
Gets the current configuration for the given cloud module.
Checks the process dictionary first for dynamic config, falls back to static config.
Sets dynamic configuration for the current process.
This configuration will be used for all subsequent operations in this process until changed or deleted.
Executes a function with a specific configuration.
The configuration is only active during the execution of the function. Previous configuration is restored afterwards.