Skip to content

Commit

Permalink
read session token if exists
Browse files Browse the repository at this point in the history
  • Loading branch information
ianic committed Nov 4, 2021
1 parent 8cd8d41 commit c8b4165
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ jobs:
# - name: Test controller
# working-directory: ./cli/controller
# run: go test -v ./...
# - name: Test all
# working-directory:
# run: go test ./...
- name: Run tests
working-directory:
run: go test -v ./domain/... && go test -v ./...

- name: Configure AWS Credentials to mantil-io account
uses: aws-actions/configure-aws-credentials@v1
with:
Expand All @@ -27,6 +28,7 @@ jobs:
aws-region: eu-central-1
- name: Build cli and deploy functions
run: ./scripts/deploy_github_action.sh

- name: Configure AWS Credentials to org5 account
uses: aws-actions/configure-aws-credentials@v1
with:
Expand Down
5 changes: 4 additions & 1 deletion cli/controller/setup_args.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ const (
accessKeyIDEnv = "AWS_ACCESS_KEY_ID"
secretAccessKeyEnv = "AWS_SECRET_ACCESS_KEY"
regionEnv = "AWS_DEFAULT_REGION"
sessionTokenEnv = "AWS_SESSION_TOKEN"
)

type SetupArgs struct {
AccessKeyID string
SecretAccessKey string
SessionToken string
Region string
Profile string
UseEnv bool
Expand Down Expand Up @@ -78,6 +80,7 @@ func (a *SetupArgs) readFromEnv() error {
if a.Region == "" {
return errf(regionEnv)
}
a.SessionToken, _ = os.LookupEnv(sessionTokenEnv)
return nil
}

Expand All @@ -95,5 +98,5 @@ func (a *SetupArgs) awsClient() (*aws.AWS, error) {
if a.Profile != "" {
return aws.NewFromProfile(a.Profile)
}
return aws.NewWithCredentials(a.AccessKeyID, a.SecretAccessKey, "", a.Region)
return aws.NewWithCredentials(a.AccessKeyID, a.SecretAccessKey, a.SessionToken, a.Region)
}

0 comments on commit c8b4165

Please sign in to comment.