Skip to content

Commit

Permalink
parse compute.Memory when creating an ephemeral machine (#4073)
Browse files Browse the repository at this point in the history
  • Loading branch information
rubys authored Nov 22, 2024
1 parent cbed81c commit df66a0a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions internal/command/console/console.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ import (
"fmt"
"maps"

"github.com/docker/go-units"
"github.com/google/shlex"
"github.com/samber/lo"
"github.com/spf13/cobra"

fly "github.com/superfly/fly-go"
"github.com/superfly/fly-go/flaps"
"github.com/superfly/flyctl/helpers"
"github.com/superfly/flyctl/internal/appconfig"
"github.com/superfly/flyctl/internal/cmdutil"
"github.com/superfly/flyctl/internal/command"
Expand Down Expand Up @@ -402,6 +404,15 @@ func determineEphemeralConsoleMachineGuest(ctx context.Context, appConfig *appco

if compute := appConfig.ComputeForGroup("console"); compute != nil {
guest = compute.MachineGuest

if compute.Memory != "" {
mb, err := helpers.ParseSize(compute.Memory, units.RAMInBytes, units.MiB)
if err != nil {
return nil, fmt.Errorf("invalid memory size: %w", err)
}

guest.MemoryMB = mb
}
}

guest, err := flag.GetMachineGuest(ctx, guest)
Expand Down

0 comments on commit df66a0a

Please sign in to comment.