Skip to content

Commit

Permalink
Merge pull request fermyon#176 from kate-goldenring/deploy-linking-de…
Browse files Browse the repository at this point in the history
…scription

Specify that KV stores and links can be created in non-interactive mode
  • Loading branch information
kate-goldenring committed Jan 29, 2024
2 parents de9fe50 + 9a2240e commit 9258930
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/commands/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,9 @@ pub struct DeployCommand {
/// non-interactive environments such as release pipelines; therefore,
/// if any links are specified, all links must be specified.
///
/// Links must be of the form 'sqlite:label=database'. Databases that
/// do not exist will be created.
/// Links must be of the form 'sqlite:label=database' or
/// 'kv:label=store'. Databases or key value stores that do not exist
/// will be created.
#[clap(long = "link")]
pub links: Vec<String>,
}
Expand Down Expand Up @@ -1011,7 +1012,7 @@ impl FromStr for LinkageSpec {
};

let Some((label, resource)) = pair.split_once('=') else {
bail!("Links must be of the form '<resource-identifier>:label=resource'");
bail!("Links must be of the form 'sqlite:label=database' or 'kv:label=store'");
};

let label = label.trim();
Expand All @@ -1028,7 +1029,7 @@ impl FromStr for LinkageSpec {
resource_name: resource.to_owned(),
resource_type: ResourceType::KeyValueStore,
}),
_ => bail!("Links must be of the form '<resource-identifier>:label=resource"),
_ => bail!("Links must be of the form 'sqlite:label=database' or 'kv:label=store'"),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/deploy/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ pub(super) async fn create_resources_for_new_app(
let label_types = db_label_types
.chain(kv_label_types)
.collect::<Vec<(_, _)>>();
println!("Creating resources {label_types:?}");
for (label, resource_type) in label_types {
let resource = match get_resource_selection_for_new_app(
app_name,
Expand All @@ -279,6 +278,7 @@ pub(super) async fn create_resources_for_new_app(
{
ResourceSelection::Existing(r) => r,
ResourceSelection::New(r) => {
println!("Creating {resource_type} named '{r}'");
match resource_type {
ResourceType::Database => {
client
Expand Down

0 comments on commit 9258930

Please sign in to comment.