Skip to content

Commit

Permalink
image-ref flag for pg dev
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldwan committed May 31, 2021
1 parent 4978892 commit a2bdeb7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions api/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,7 @@ type CreatePostgresClusterInput struct {
Password *string `json:"password,omitempty"`
VMSize *string `json:"vmSize,omitempty"`
VolumeSizeGB *int `json:"volumeSizeGb,omitempty"`
ImageRef *string `json:"imageRef,omitempty"`
}

type CreatePostgresClusterPayload struct {
Expand Down
5 changes: 5 additions & 0 deletions cmd/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ func newPostgresCommand(client *client.Client) *Command {
createCmd.AddStringFlag(StringFlagOpts{Name: "password", Description: "the superuser password. one will be generated for you if you leave this blank"})
createCmd.AddStringFlag(StringFlagOpts{Name: "volume-size", Description: "the size in GB for volumes"})
createCmd.AddStringFlag(StringFlagOpts{Name: "vm-size", Description: "the size of the VM"})
createCmd.AddStringFlag(StringFlagOpts{Name: "image-ref", Hidden: true})

attachStrngs := docstrings.Get("postgres.attach")
attachCmd := BuildCommandKS(cmd, runAttachPostgresCluster, attachStrngs, client, requireSession, requireAppName)
Expand Down Expand Up @@ -122,6 +123,10 @@ func runCreatePostgresCluster(ctx *cmdctx.CmdContext) error {
VolumeSizeGB: api.IntPointer(volumeSize),
}

if imageRef := ctx.Config.GetString("image-ref"); imageRef != "" {
input.ImageRef = api.StringPointer(imageRef)
}

fmt.Fprintf(ctx.Out, "Creating postgres cluster %s in organization %s\n", name, org.Slug)

s := spinner.New(spinner.CharSets[11], 100*time.Millisecond)
Expand Down

0 comments on commit a2bdeb7

Please sign in to comment.