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

Commit

Permalink
Merge pull request #1065 from cloudflare/alewis/naming-is-hard
Browse files Browse the repository at this point in the history
s/text/vars/
  • Loading branch information
ashleygwilliams authored Feb 14, 2020
2 parents 94e117c + 4e9ceb0 commit eea1137
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/commands/kv/bucket/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ mod tests {
target_type: TargetType::JavaScript,
webpack_config: None,
site: Some(site),
text: None,
vars: None,
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/commands/kv/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ mod tests {
target_type: TargetType::Webpack,
webpack_config: None,
site: None,
text: None,
vars: None,
};
assert!(kv::get_namespace_id(&target_with_dup_kv_bindings, "").is_err());
}
Expand Down
4 changes: 2 additions & 2 deletions src/commands/publish/upload_form/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ pub fn build(
let mut plain_texts: Vec<PlainText> = Vec::new();
let mut wasm_modules: Vec<WasmModule> = Vec::new();

if let Some(text) = &target.text {
for (key, value) in text.iter() {
if let Some(vars) = &target.vars {
for (key, value) in vars.iter() {
plain_texts.push(PlainText::new(key.clone(), value.clone())?)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/settings/toml/environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub struct Environment {
pub site: Option<Site>,
#[serde(rename = "kv-namespaces")]
pub kv_namespaces: Option<Vec<KvNamespace>>,
pub text: Option<HashMap<String, String>>,
pub vars: Option<HashMap<String, String>>,
}

impl Environment {
Expand Down
14 changes: 7 additions & 7 deletions src/settings/toml/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub struct Manifest {
#[serde(rename = "kv-namespaces")]
pub kv_namespaces: Option<Vec<KvNamespace>>,
pub env: Option<HashMap<String, Environment>>,
pub text: Option<HashMap<String, String>>,
pub vars: Option<HashMap<String, String>>,
}

impl Manifest {
Expand Down Expand Up @@ -190,7 +190,7 @@ impl Manifest {
name: self.name.clone(), // MAY inherit
kv_namespaces: self.kv_namespaces.clone(), // MUST NOT inherit
site: self.site.clone(), // MUST NOT inherit
text: self.text.clone(), // MAY inherit
vars: self.vars.clone(), // MAY inherit
};

let environment = self.get_environment(environment_name)?;
Expand All @@ -203,11 +203,11 @@ impl Manifest {
if let Some(webpack_config) = &environment.webpack_config {
target.webpack_config = Some(webpack_config.clone());
}
if let Some(target_text) = &mut target.text.clone() {
if let Some(env_text) = environment.text.clone() {
target_text.extend(env_text);
let new_text = target_text.clone();
target.text.replace(new_text);
if let Some(target_vars) = &mut target.vars.clone() {
if let Some(env_vars) = environment.vars.clone() {
target_vars.extend(env_vars);
let new_vars = target_vars.clone();
target.vars.replace(new_vars);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/settings/toml/target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub struct Target {
pub target_type: TargetType,
pub webpack_config: Option<String>,
pub site: Option<Site>,
pub text: Option<HashMap<String, String>>,
pub vars: Option<HashMap<String, String>>,
}

impl Target {
Expand Down

0 comments on commit eea1137

Please sign in to comment.