Skip to content

Commit

Permalink
clog and aws add env config struct tags (#791)
Browse files Browse the repository at this point in the history
this allows me to configure sidecars that are configured using env vars
to easily re-use the clog and aws configuration libraries.
  • Loading branch information
julesjcraske authored Jan 2, 2025
1 parent 4ae0600 commit d58bd07
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/clog/clog.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ type Config struct {
// Format configures the output format. Possible options:
// - text - logrus default text output, good for local development
// - json - fields and message encoded as json, good for storage in e.g. cloudwatch
Format string `json:"format"`
Format string `json:"format" env:"FORMAT" envDefault:"json"`

// Debug enables debug level logging, otherwise INFO level
Debug bool `json:"debug"`
Debug bool `json:"debug" env:"DEBUG" envDefault:"false"`
}

// Configure applies Cuvva standard Logging structure options to a logrus Entry.
Expand Down
6 changes: 3 additions & 3 deletions lib/config/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import (
// AWS configures credentials for access to Amazon Web Services.
// It is intended to be used in composition rather than a key.
type AWS struct {
AccessKeyID string `json:"access_key_id"`
AccessKeySecret string `json:"access_key_secret"`
AccessKeyID string `json:"access_key_id" env:"AWS_ACCESS_KEY_ID"`
AccessKeySecret string `json:"access_key_secret" env:"AWS_SECRET_ACCESS_KEY"`

Region string `json:"region,omitempty"`
Region string `json:"region,omitempty" env:"AWS_REGION"`
}

// Credentials returns a configured set of AWS credentials.
Expand Down

0 comments on commit d58bd07

Please sign in to comment.