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

Commit

Permalink
validate account id existence
Browse files Browse the repository at this point in the history
  • Loading branch information
EverlastingBugstopper committed Jun 26, 2020
1 parent 08c4944 commit 9360438
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 48 deletions.
13 changes: 11 additions & 2 deletions src/settings/toml/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,21 @@ impl Manifest {

pub fn get_account_id(&self, environment_name: Option<&str>) -> Result<String, failure::Error> {
let environment = self.get_environment(environment_name)?;
let mut result = self.account_id.to_string();
if let Some(environment) = environment {
if let Some(account_id) = &environment.account_id {
return Ok(account_id.to_string());
result = account_id.to_string();
}
}
Ok(self.account_id.to_string())
if result.is_empty() {
let mut msg = "Your wrangler.toml is missing an account_id field".to_string();
if let Some(environment_name) = environment_name {
msg.push_str(&format!("in [env.{}]", environment_name));
}
failure::bail!("{}", &msg)
} else {
Ok(result)
}
}

pub fn get_target(
Expand Down
46 changes: 0 additions & 46 deletions tests/namespace.rs

This file was deleted.

0 comments on commit 9360438

Please sign in to comment.