Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement starting instances from a HTTP URL #276

Merged
merged 1 commit into from
Sep 29, 2021

Conversation

afbjorklund
Copy link
Member

Closes #237

Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
Copy link
Member

@jandubois jandubois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Tested with

limactl start https://raw.githubusercontent.com/lima-vm/lima/master/examples/podman.yaml

@jandubois jandubois merged commit ef09091 into lima-vm:master Sep 29, 2021
@jandubois
Copy link
Member

Thanks!

return nil, err
}
defer resp.Body.Close()
yBytes, err = io.ReadAll(resp.Body)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should check body size before calling ReadAll

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for jumping the gun on merging already 😞

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, hopefully it would return an error in that case ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just used the https://pkg.go.dev/net/http sample code

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use https://pkg.go.dev/io#LimitedReader and it raises io.EOF when it reaches the limit (e.g., 1MB).
We should wrap the io.EOF error with a human-readable text.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, so it was limit "protection" rather than looking for zero bytes

Copy link
Member Author

@afbjorklund afbjorklund Sep 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but wouldn't the same thing happen with a local file as well ?

                yBytes, err = os.ReadFile(arg)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR: #279

@AkihiroSuda AkihiroSuda added this to the v0.7.0 milestone Sep 29, 2021
AkihiroSuda added a commit that referenced this pull request Sep 30, 2021
Follow-up to `Implement starting instances from a HTTP URL ` (#276)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow running start directly from an URL
3 participants