Skip to content

Commit

Permalink
Merge pull request #123 from kubefirst/fix_env_region
Browse files Browse the repository at this point in the history
fix: remove required env value, and allow init command to collect it
  • Loading branch information
João Paulo Vanzuita committed Jul 19, 2022
2 parents 07c2566 + f9d71cc commit 1960b7f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ The setup is extremely simple, create a `.env` file in the root folder, and add
| Variable | example |
|--------------------|------------------|
| AWS_PROFILE | default |
| AWS_REGION | us-east-1 |
| CLOUD_PROVIDER=aws | aws |
| HOSTED_ZONE_NAME | example.com |
| ADMIN_EMAIL | john@example.com |
Expand Down
6 changes: 6 additions & 0 deletions cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"log"
"os"
"strings"
"time"

Expand Down Expand Up @@ -80,6 +81,11 @@ to quickly create a Cobra application.`,
// name of the cloud region to provision resources when resources are region-specific
region, _ := cmd.Flags().GetString("region")
viper.Set("aws.region", region)
// propagate it to local environment
err = os.Setenv("AWS_REGION", region)
if err != nil {
log.Panicf("unable to set environment variable AWS_REGION, error is: %v", err)
}
log.Println("region:", region)

// cluster name
Expand Down
1 change: 0 additions & 1 deletion configs/envvars.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ func CheckEnvironment() error {

requiredEnvValues := map[string]string{
"AWS_PROFILE": os.Getenv("AWS_PROFILE"),
"AWS_REGION": os.Getenv("AWS_REGION"),
}

for k, v := range requiredEnvValues {
Expand Down

0 comments on commit 1960b7f

Please sign in to comment.