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

Print HTTP routes on deploy #568

Merged
merged 1 commit into from
Jun 14, 2022
Merged

Conversation

itowlson
Copy link
Contributor

Fixes #566.

@michelleN I'm afraid I can't yet test this because I can't get the Hippo-Nomad stuff working correctly yet. I will try to get that sorted in the morning. If you have time do feel free to give this a quick test - I think it is right but am not sure in exactly what form Hippo returns the channel domain, so that at least is quite likely to be wrong! Sorry!

@itowlson itowlson requested a review from michelleN June 14, 2022 05:34
@fibonacci1729
Copy link
Contributor

fibonacci1729 commented Jun 14, 2022

Seems to work! Just verified against the local installer:

$ spin deploy
Successfully deployed application spin-hello-world version 1.0.0!
Application is running at spin-hello-world.spin-hello-world.local.fermyon.link
Available Routes:
  hello: http://spin-hello-world.spin-hello-world.local.fermyon.link/hello
    A simple component that returns hello.

$ curl -i http://spin-hello-world.spin-hello-world.local.fermyon.link/hello
HTTP/1.1 200 OK
Content-Length: 16
Date: Tue, 14 Jun 2022 13:35:11 GMT
Foo: bar
Content-Type: text/plain; charset=utf-8

Hello, Fermyon!

Copy link
Member

@michelleN michelleN left a comment

Choose a reason for hiding this comment

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

I just tested and it works! I have a few minor comments. Thank you!

examples/http-rust [itowlson-deploy-print-routes] $ spin deploy
Successfully deployed application spin-hello-world version 1.0.0!
Application is running at spin-hello-world.spin-hello-world.local.fermyon.link
Available Routes:
  hello: http://spin-hello-world.spin-hello-world.local.fermyon.link/hello
    A simple component that returns hello.

if let TriggerConfig::Http(http_cfg) = &component.trigger {
let route = RoutePattern::from(base, &http_cfg.route);
println!(" {}: http://{}{}", component.id, address, route);
if let Some(description) = &component.description {
Copy link
Member

@michelleN michelleN Jun 14, 2022

Choose a reason for hiding this comment

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

I think removing the description might make the output cleaner.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did this for consistency with the local printing of routes but can remove it if folks prefer!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah if we don't like the format it seems reasonable to change both (in a separate PR).

Copy link
Member

Choose a reason for hiding this comment

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

sounds good

src/commands/deploy.rs Outdated Show resolved Hide resolved
@vdice vdice added this to the v0.3.0 milestone Jun 14, 2022
@itowlson itowlson marked this pull request as ready for review June 14, 2022 20:28
Comment on lines 160 to 163
println!("Application is running at {}", channel.domain);
print_available_routes(&channel.domain, &http_config.base, &cfg);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
println!("Application is running at {}", channel.domain);
print_available_routes(&channel.domain, &http_config.base, &cfg);
}
print_available_routes(&channel.domain, &http_config.base, &cfg);
} else {
println!("Application is running at {}", channel.domain);
}

Signed-off-by: itowlson <ivan.towlson@fermyon.com>
@itowlson itowlson merged commit b4ca6d1 into fermyon:main Jun 14, 2022
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.

return routes available in spin deploy output
5 participants