Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix env vars #175

Merged
merged 3 commits into from
Mar 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 30 additions & 3 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"context"
"fmt"
"os"
"strings"

"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
Expand Down Expand Up @@ -76,7 +77,7 @@
}
}

func Handler(ctx context.Context, event events.CodePipelineEvent) (string, error) {

Check failure on line 80 in cmd/root.go

View workflow job for this annotation

GitHub Actions / test

exported function Handler should have comment or be unexported
log.Debug(event)
err := rootCmd.Execute()
s := session.Must(session.NewSession())
Expand Down Expand Up @@ -107,7 +108,7 @@
log.Fatalf(errors.Wrap(err, "Failed to update CodePipeline jobID status").Error())
}
return "Failure", err
} else {

Check failure on line 111 in cmd/root.go

View workflow job for this annotation

GitHub Actions / test

if block ends with a return statement, so drop this else and outdent its block
log.Info("Notifying CodePipeline and mark its job execution as Success")
jobID := event.CodePipelineJob.ID
if len(jobID) == 0 {
Expand All @@ -127,7 +128,7 @@
if err != nil {
log.Fatalf(errors.Wrap(err, "Notifying Lambda and mark this execution as Failure").Error())
return "Failure", err
} else {

Check failure on line 131 in cmd/root.go

View workflow job for this annotation

GitHub Actions / test

if block ends with a return statement, so drop this else and outdent its block
return "Success", nil
}
}
Expand Down Expand Up @@ -192,7 +193,7 @@
}

func configLambda() {
s := session.Must(session.NewSession())
s := session.Must(session.NewSession())
svc := secretsmanager.New(s)
secrets := config.NewSecrets(svc)

Expand Down Expand Up @@ -232,9 +233,9 @@
}
cfg.IdentityStoreID = unwrap

unwrap = os.Getenv("LOG_LEVEL")
unwrap = os.Getenv("LOG_LEVEL")
if len([]rune(unwrap)) != 0 {
cfg.LogLevel = unwrap
cfg.LogLevel = unwrap
}

unwrap = os.Getenv("LOG_FORMAT")
Expand All @@ -246,6 +247,32 @@
if len([]rune(unwrap)) != 0 {
cfg.SyncMethod = unwrap
}

unwrap = os.Getenv("USER_MATCH")
if len([]rune(unwrap)) != 0 {
cfg.UserMatch = unwrap
}

unwrap = os.Getenv("GROUP_MATCH")
if len([]rune(unwrap)) != 0 {
cfg.GroupMatch = unwrap
}

unwrap = os.Getenv("IGNORE_GROUPS")
if len([]rune(unwrap)) != 0 {
cfg.IgnoreGroups = strings.Split(unwrap, ",")
}

unwrap = os.Getenv("IGNORE_USERS")
if len([]rune(unwrap)) != 0 {
cfg.IgnoreUsers = strings.Split(unwrap, ",")
}

unwrap = os.Getenv("INCLUDE_GROUPS")
if len([]rune(unwrap)) != 0 {
cfg.IncludeGroups = strings.Split(unwrap, ",")
}

}

func addFlags(cmd *cobra.Command, cfg *config.Config) {
Expand Down
Loading