Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

Alewis/publish multiple routes #922

Merged
merged 3 commits into from
Dec 4, 2019

Conversation

ashleymichal
Copy link
Contributor

this pr gets us to where we actually publish all specified routes within a wrangler toml.

todo:
unit tests
at least one integration test
improve output to show how routes were updated/maintained.

@ashleymichal ashleymichal added changelog - feature regression Something is broken, but works in previous releases labels Dec 3, 2019
@ashleymichal ashleymichal added this to the Multi Route Support milestone Dec 3, 2019
@ashleymichal ashleymichal requested a review from a team December 3, 2019 19:08
@ashleymichal ashleymichal self-assigned this Dec 3, 2019
if !route.ends_with("*") {
message::warn(&format!("The route in your wrangler.toml should have a trailing * to apply the Worker on every path, otherwise your site will not behave as expected.\nroute = {}*", route));
}
}
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 moved this down into the deploy routes function, since it's only relevant to that path

let routes = target.routes()?;
log::info!("routes: {:#?}", &routes);

if routes.is_empty() {
Copy link
Contributor Author

@ashleymichal ashleymichal Dec 3, 2019

Choose a reason for hiding this comment

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

i'm nearly inclined to move this all just into the top level command function, since it doesn't really return anything, just does the console output.

Copy link
Contributor

Choose a reason for hiding this comment

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

i think i'd rather it be its own function than in the top level

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 guess what i meant was, all the std out output and switching on routes etc. but i also think i might futz with this so i'm into it staying here

@@ -132,25 +151,6 @@ fn error_msg(status: reqwest::StatusCode, text: String) -> String {
}
}

#[test]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

nothing about this test changed, i just moved it to the bottom of the module.

@@ -258,7 +258,7 @@ fn validate_target_required_fields_present(target: &Target) -> Result<(), failur
None => {}
}

let destination = if target.route.is_some() {
let destination = if let Some(route) = &target.route {
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 could fix this to check if target.routes()?.is_empty(), however i'm also inclined to shift some of this logic into something like a Manifest::get_deploy_config function instead, so we can keep all the logic around what is needed to publish in one place; right now it is spread across this module and settings::target

* include (optional) id in Route struct
* remove unused Route::new() method
* include upload result information in output of routes deploy function
* split upload script and deploy into two functions
@ashleymichal ashleymichal merged commit f64b55a into feat-multi-route Dec 4, 2019
@delete-merged-branch delete-merged-branch bot deleted the alewis/publish-multiple-routes branch December 4, 2019 01:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
regression Something is broken, but works in previous releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants