providers
OtherRuntime, config-driven selection of capability backends for togo — swap impl/exec/compute/data/queue/storage backends over CLI, .env, or settings
togo install togo-framework/providersInstall
togo install togo-framework/providersRuntime, config-driven selection of which backend is active for a capability —
swap it over CLI / .env / settings without recompiling.
togo already has the registry (RegisterProviderFunc), the capability contracts
(togo.Cache / Queue / Storage / Broker), the container (k.Set/Get), and
the <capability>-<backend> plugin convention (storage-s3, realtime-nats, …).
The one missing piece is picking which backend wins at runtime. This package
adds exactly that — and nothing else. It stores no config itself; the
settings plugin is the store.
Selection order (highest wins)
1. env TOGO_<CAP>_PROVIDER=iceberg # or a CLI flag that sets it
2. settings providers.<cap>.active # togo.yaml / settings plugin
3. default the backend registered with def=true
Use it — in a backend plugin
import "github.com/togo-framework/providers"
func init() {
togo.RegisterProviderFunc("db-iceberg", togo.PriorityService, func(k *togo.Kernel) error {
// installs itself as the "data" service ONLY if selected (def=false → opt-in)
providers.Use(k, providers.CapData, "iceberg", newIceberg(k), false)
return nil
})
}
Read provider config the dynamic way (env → settings → default; secrets env-only):
url := providers.Value(k, providers.CapExecute, "coder", "url", "http://localhost:7080", false)
token := providers.Value(k, providers.CapExecute, "coder", "token", "", true) // secret
Capabilities
Constant | Contract | Backends |
|---|---|---|
| CapCache CapQueue CapStorage CapRealtime | existing (togo core) | e.g. storage-s3, queue-nats, realtime-nats |
| CapImplement CapExecute | autopilot | claude/omnigent, local/coder |
| CapCompute | worker | worker-local/beam/spark/flink/databricks |
| CapData CapCatalog CapShare | db / catalog / sharing | pg/iceberg/bigquery/databricks, … |
Install
togo install togo-framework/providers<div align="center"> <h3>💎 Premium sponsors</h3> <p> <a href="https://id8media.com"><img src=".github/assets/id8media.svg" height="44" alt="ID8 Media" /></a> <a href="https://one-studio.co"><img src=".github/assets/one-studio.jpeg" height="44" alt="One Studio" /></a> </p> <p><sub>Support togo — <a href="https://github.com/sponsors/fadymondy">become a sponsor</a>.</sub></p> </div>