pub struct CoreBuilder { /* private fields */ }Expand description
Builder for constructing SecretsCore instances.
Implementations§
Source§impl CoreBuilder
impl CoreBuilder
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Initialise the builder using environment configuration.
GREENTIC_SECRETS_TENANTsets the default tenant (default:"default").GREENTIC_SECRETS_TEAMsets an optional team scope.GREENTIC_SECRETS_CACHE_TTL_SECSoverrides the cache TTL (default: 300s).GREENTIC_SECRETS_NATS_URLrecords the NATS endpoint (unused today).GREENTIC_SECRETS_DEVenables the in-memory backend (default: enabled).
Sourcepub fn tenant(self, tenant: impl Into<String>) -> Self
pub fn tenant(self, tenant: impl Into<String>) -> Self
Set the tenant scope attached to the runtime.
Sourcepub fn default_ttl(self, ttl: Duration) -> Self
pub fn default_ttl(self, ttl: Duration) -> Self
Override the default cache TTL.
Sourcepub fn cache_capacity(self, capacity: usize) -> Self
pub fn cache_capacity(self, capacity: usize) -> Self
Override the cache capacity (number of entries).
Sourcepub fn backend<B, K>(self, backend: B, key_provider: K) -> Selfwhere
B: SecretsBackend + 'static,
K: KeyProvider + 'static,
pub fn backend<B, K>(self, backend: B, key_provider: K) -> Selfwhere
B: SecretsBackend + 'static,
K: KeyProvider + 'static,
Register a backend with its corresponding key provider.
Sourcepub fn backend_named<B, K>(
self,
name: impl Into<String>,
backend: B,
key_provider: K,
) -> Selfwhere
B: SecretsBackend + 'static,
K: KeyProvider + 'static,
pub fn backend_named<B, K>(
self,
name: impl Into<String>,
backend: B,
key_provider: K,
) -> Selfwhere
B: SecretsBackend + 'static,
K: KeyProvider + 'static,
Register a backend with a specific identifier.
Sourcepub fn with_backend<B>(self, name: impl Into<String>, backend: B) -> Selfwhere
B: SecretsBackend + 'static,
pub fn with_backend<B>(self, name: impl Into<String>, backend: B) -> Selfwhere
B: SecretsBackend + 'static,
Register a backend with the default memory key provider.
Sourcepub fn clear_backends(&mut self)
pub fn clear_backends(&mut self)
Remove any previously registered backends.
Sourcepub async fn auto_detect_backends(self) -> Self
pub async fn auto_detect_backends(self) -> Self
If no backends have been explicitly registered, add sensible defaults.
The current implementation falls back to the environment backend and,
when configured via GREENTIC_SECRETS_FILE_ROOT, the filesystem backend.
Future revisions will extend this to include cloud provider probes.
Sourcepub fn policy(self, policy: Policy) -> Self
pub fn policy(self, policy: Policy) -> Self
Override the policy (currently only AllowAll is supported).
Sourcepub async fn build(self) -> Result<SecretsCore, SecretsError>
pub async fn build(self) -> Result<SecretsCore, SecretsError>
Build the SecretsCore instance.