Skip to content

Commit

Permalink
Add GCR-URL environment variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Teddy-Schmitz committed Mar 20, 2017
1 parent a22f641 commit 5f311c3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ func validateParams() {
// Allow environment variables to overwrite args
awsAccountIDEnv := os.Getenv("awsaccount")
awsRegionEnv := os.Getenv("awsregion")
gcrURLEnv := os.Getenv("gcrurl")

if len(awsRegionEnv) > 0 {
argAWSRegion = &awsRegionEnv
Expand All @@ -263,6 +264,10 @@ func validateParams() {
if len(awsAccountIDEnv) > 0 {
awsAccountID = awsAccountIDEnv
}

if len(gcrURLEnv) > 0 {
argGCRURL = &gcrURLEnv
}
}

func handler(c *controller, ns *v1.Namespace) error {
Expand Down
9 changes: 9 additions & 0 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,15 @@ func TestAwsRegionFromEnv(t *testing.T) {
assert.Equal(t, expectedRegion, *argAWSRegion)
}

func TestGcrURLFromEnv(t *testing.T) {
expectedURL := "http://test.me"

os.Setenv("gcrurl", "http://test.me")
validateParams()

assert.Equal(t, expectedURL, *argGCRURL)
}

func TestFailingGcrPassingEcrStillSucceeds(t *testing.T) {
util := newKubeUtil()
ecrClient := newFakeEcrClient()
Expand Down

0 comments on commit 5f311c3

Please sign in to comment.