Table of Contents

Class LocalSecretsProvider

Namespace
Builvero.Infrastructure.Services
Assembly
Builvero.Infrastructure.dll

Local secrets provider that reads from environment variables or mounted config files. Used only when BUILVERO_ENV=local. No AWS SDK usage.

public sealed class LocalSecretsProvider : ISecretsProvider
Inheritance
LocalSecretsProvider
Implements
Inherited Members

Constructors

LocalSecretsProvider(ILogger<LocalSecretsProvider>, string?)

Initializes a new instance of the LocalSecretsProvider class.

public LocalSecretsProvider(ILogger<LocalSecretsProvider> logger, string? secretsDirectory = null)

Parameters

logger ILogger<LocalSecretsProvider>

Logger for recording secret operations.

secretsDirectory string

Optional directory path for mounted secret files (e.g., "/etc/secrets"). If null, only environment variables are used.

Methods

GetRequiredSecretAsync(string, CancellationToken)

Retrieves a secret value by name, throwing an exception if not found.

public Task<string> GetRequiredSecretAsync(string secretName, CancellationToken cancellationToken = default)

Parameters

secretName string

The name or identifier of the secret.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<string>

The secret value.

Exceptions

InvalidOperationException

Thrown when the secret is not found.

GetSecretAsync(string, CancellationToken)

Retrieves a secret value by name.

public Task<string?> GetSecretAsync(string secretName, CancellationToken cancellationToken = default)

Parameters

secretName string

The name or identifier of the secret.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<string>

The secret value, or null if not found.