Skip to contents

Constructs a list of arguments for storage plugin functions (e.g., `load_from_file`, `save_to_mongo`). It merges the base arguments passed directly with plugin-specific configuration from environment variables.

Usage

build_plugin_args(backend, mode = "load", ...)

Arguments

backend

A string indicating the backend (e.g., "file", "mongo", "gdrive").

mode

The operation mode, one of "load", "save", "file_exists", or "remove".

...

Additional arguments (e.g., `user_id`, `file_name`, etc.).

Value

A named list of arguments suitable for `do.call()` when calling a plugin function.

Details

Supports backends such as local file system, MongoDB, and Google Drive.

Examples

Sys.setenv(ACCOUNT_BASE_DIR = "user_accounts")
args <- build_plugin_args(
  "file", "load",
  user_id = "user1",
  file_name = "account_tree.Rds"
)
# Returns something like:
# list(user_id = "user1", file_name = "account_tree.Rds",
#      base_dir = "user_accounts")