Documentation ¶
Overview ¶
sg-common/secrets/secrets.go
Secrets, also called secret keys, are crucial components in this application. During development, we will store and fetch secrets from environment variables. In production, we need to use a secret management service such as GCP Secret Manager. The secrets package makes fetching secrets an abstract operation, independent of whether the secretscome from environment variables or Secret Manager. This allows us to easily switch from using environment variables during local development to using Secret Manager in the production environment. Implementation: Secrets is implemented as a shared library that can be used by any microservice that needs it. Implementation involves 3 steps: Develop a Secret Fetching Interface; Implement the Interface for Both Methods (fetching secrets from environment variables, and fetching secrets from Secret manager); Decide on the Method at Runtime.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EnvVarSecretFetcher ¶
type EnvVarSecretFetcher struct{}
type GcpSecretManagerFetcher ¶
type GcpSecretManagerFetcher struct {
// contains filtered or unexported fields
}
func NewGcpSecretManagerFetcher ¶
func NewGcpSecretManagerFetcher(projectID string, credentialsFile string) (*GcpSecretManagerFetcher, error)
type SecretFetcher ¶
func GetFetcher ¶
func GetFetcher() SecretFetcher
Click to show internal directories.
Click to hide internal directories.