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 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§
Source§impl Default for CoreBuilder
impl Default for CoreBuilder
Source§fn default() -> CoreBuilder
fn default() -> CoreBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for CoreBuilder
impl !RefUnwindSafe for CoreBuilder
impl Send for CoreBuilder
impl Sync for CoreBuilder
impl Unpin 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
Mutably borrows from an owned value. Read more