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.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CoreBuilder
impl !RefUnwindSafe for CoreBuilder
impl Send for CoreBuilder
impl Sync for CoreBuilder
impl Unpin for CoreBuilder
impl UnsafeUnpin for CoreBuilder
impl !UnwindSafe for CoreBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request