Allow token and organization id to be passed via env vars
This commit is contained in:
parent
e46108298c
commit
9b611af7e6
|
@ -3,6 +3,7 @@ package scaleway
|
|||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/hashicorp/packer/common"
|
||||
"github.com/hashicorp/packer/common/uuid"
|
||||
|
@ -51,6 +52,14 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) {
|
|||
|
||||
c.UserAgent = "Packer - Scaleway builder"
|
||||
|
||||
if c.Organization == "" {
|
||||
c.Organization = os.Getenv("SCALEWAY_API_ORGANIZATION")
|
||||
}
|
||||
|
||||
if c.Token == "" {
|
||||
c.Token = os.Getenv("SCALEWAY_API_TOKEN")
|
||||
}
|
||||
|
||||
if c.SnapshotName == "" {
|
||||
def, err := interpolate.Render("packer-{{timestamp}}", nil)
|
||||
if err != nil {
|
||||
|
|
|
@ -37,8 +37,12 @@ builder.
|
|||
### Required:
|
||||
|
||||
- `api_organization` (string) - The organization ID to use to access your account.
|
||||
It can also be specified via
|
||||
environment variable `SCALEWAY_API_ORGANIZATION`.
|
||||
|
||||
- `api_token` (string) - The organization TOKEN to use to access your account.
|
||||
It can also be specified via
|
||||
environment variable `SCALEWAY_API_TOKEN`.
|
||||
|
||||
- `image` (string) - The UUID of the base image to use. This is the
|
||||
image that will be used to launch a new server and provision it. See
|
||||
|
|
Loading…
Reference in New Issue