Skip to content

Commit

Permalink
Update root.go
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisPates committed Mar 8, 2024
1 parent b0c3898 commit bdc99bd
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"context"
"fmt"
"os"
"strings"

"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
Expand Down Expand Up @@ -196,16 +197,6 @@ func configLambda() {
svc := secretsmanager.New(s)
secrets := config.NewSecrets(svc)

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

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

unwrap, err := secrets.GoogleAdminEmail(os.Getenv("GOOGLE_ADMIN"))
if err != nil {
log.Fatalf(errors.Wrap(err, "cannot read config").Error())
Expand Down Expand Up @@ -242,34 +233,44 @@ func configLambda() {
}
cfg.IdentityStoreID = unwrap

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

unwrap = os.Getenv("GROUP_MATCH")
unwrap = os.Getenv("LOG_FORMAT")
if len([]rune(unwrap)) != 0 {
cfg.group-match = unwrap
cfg.LogFormat = unwrap
}

unwrap = os.Getenv("SYNC_METHOD")
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.ignore-groups = unwrap
cfg.IgnoreGroups = strings.Split(unwrap, ",")
}

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

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

}
Expand Down

0 comments on commit bdc99bd

Please sign in to comment.