Default to AWS_ env vars for key and secret

This commit is contained in:
Justin Campbell 2013-06-28 13:45:15 -04:00
parent adae75402f
commit 9c9c60aabf
1 changed files with 9 additions and 0 deletions

View File

@ -15,6 +15,7 @@ import (
"github.com/mitchellh/packer/builder/common"
"github.com/mitchellh/packer/packer"
"log"
"os"
"text/template"
"time"
)
@ -57,6 +58,14 @@ func (b *Builder) Prepare(raws ...interface{}) error {
}
}
if b.config.AccessKey == "" {
b.config.AccessKey = os.Getenv("AWS_ACCESS_KEY")
}
if b.config.SecretKey == "" {
b.config.SecretKey = os.Getenv("AWS_SECRET_KEY")
}
if b.config.SSHPort == 0 {
b.config.SSHPort = 22
}