Skip to content

Commit

Permalink
Add configuration for profiles to collect metrics from
Browse files Browse the repository at this point in the history
  • Loading branch information
Pokom committed May 16, 2024
1 parent 6e66137 commit 219daa6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions cmd/exporter/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ type Config struct {
ProjectID string
Providers struct {
AWS struct {
Profile string
Profiles StringSliceFlag
Region string
Services StringSliceFlag
Expand Down
6 changes: 4 additions & 2 deletions cmd/exporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ import (

func providerFlags(fs *flag.FlagSet, cfg *config.Config) {
flag.StringVar(&cfg.Provider, "provider", "aws", "aws or gcp")
fs.Var(&cfg.Providers.AWS.Profiles, "aws.profile", "AWS profile(s).")
fs.StringVar(&cfg.Providers.AWS.Profile, "aws.profile", "", "AWS Profile to authenticate with.")
fs.Var(&cfg.Providers.AWS.Profiles, "aws.profiles", "AWS Profiles to collect resources from.")
// TODO: RENAME THIS TO JUST PROJECTS
fs.Var(&cfg.Providers.GCP.Projects, "gcp.bucket-projects", "GCP project(s).")
fs.Var(&cfg.Providers.AWS.Services, "aws.services", "AWS service(s).")
Expand All @@ -51,7 +52,8 @@ func selectProvider(cfg *config.Config) (provider.Provider, error) {
case "aws":
return aws.New(&aws.Config{
Region: cfg.Providers.AWS.Region,
Profile: cfg.Providers.AWS.Profiles.String(),
Profile: cfg.Providers.AWS.Profile,
Profiles: strings.Split(cfg.Providers.AWS.Profiles.String(), ","),
ScrapeInterval: cfg.Collector.ScrapeInterval,
Services: strings.Split(cfg.Providers.AWS.Services.String(), ","),
})
Expand Down
1 change: 1 addition & 0 deletions pkg/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type Config struct {
Services []string
Region string
Profile string
Profiles []string
ScrapeInterval time.Duration
}

Expand Down

0 comments on commit 219daa6

Please sign in to comment.