Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AWSProvider ¶
type AWSProvider struct {
// contains filtered or unexported fields
}
AWSProvider is a secrets provider that fetches and caches secrets from AWS Secrets Manager.
func (*AWSProvider) GetDatabaseInfo ¶
func (p *AWSProvider) GetDatabaseInfo(ctx context.Context) (DatabaseInfo, error)
GetDatabaseInfo retrieves database connection information from an AWS Secrets Manager secret. It looks up the secret name from the DATABASE_SECRET_NAME environment variable. Returns an error if the environment variable is not set, if the secret is not found, or if the secret is invalid JSON.
type DatabaseInfo ¶
type EnvProvider ¶
type EnvProvider struct{}
EnvProvider retrieves secrets from environment variables instead of external secret management systems.
func (*EnvProvider) GetDatabaseInfo ¶
func (p *EnvProvider) GetDatabaseInfo(ctx context.Context) (DatabaseInfo, error)
GetDatabaseInfo retrieves database connection information, including URL, username, and password, from environment secrets. Returns a DatabaseInfo struct and an error if any required secret is missing or could not be retrieved.
type Provider ¶
type Provider interface {
// GetSecret retrieves the secret value associated with the provided name from the underlying storage or environment.
GetSecret(ctx context.Context, name string) (string, error)
// GetDatabaseInfo retrieves database connection details such as URL, username, and password from the underlying provider.
GetDatabaseInfo(ctx context.Context) (DatabaseInfo, error)
}
func NewProvider ¶
NewProvider creates a new secrets Provider based on the SECRETS_PROVIDER environment variable. Returns an AWSProvider if SECRETS_PROVIDER is set to "aws", otherwise defaults to an EnvProvider.