Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Commit

Permalink
Don't require an API connection for render on a file
Browse files Browse the repository at this point in the history
Signed-off-by: Darren Shepherd <darren@acorn.io>
  • Loading branch information
ibuildthecloud committed Jul 28, 2023
1 parent 5e66842 commit af9529f
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions pkg/cli/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"github.com/acorn-io/aml/pkg/cue"
cli "github.com/acorn-io/runtime/pkg/cli/builder"
client2 "github.com/acorn-io/runtime/pkg/client"
"github.com/acorn-io/runtime/pkg/imagesource"
"github.com/spf13/cobra"
)
Expand All @@ -27,12 +28,21 @@ type Render struct {
}

func (s *Render) Run(cmd *cobra.Command, args []string) error {
c, err := s.client.CreateDefault()
var c client2.Client

imageAndArgs := imagesource.NewImageSource(s.File, args, s.Profile, nil, false)

_, file, err := imageAndArgs.ResolveImageAndFile()
if err != nil {
return err
}

imageAndArgs := imagesource.NewImageSource(s.File, args, s.Profile, nil, false)
if file == "" {
// Lazily create client so that local file render doesn't require an API connection
c, err = s.client.CreateDefault()
if err != nil {
return err
}
}

appDef, _, err := imageAndArgs.GetAppDefinition(cmd.Context(), c)
if err != nil {
Expand Down

0 comments on commit af9529f

Please sign in to comment.