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

Commit

Permalink
Remove durable objects and migrations features from custom builds tree
Browse files Browse the repository at this point in the history
  • Loading branch information
xortive committed Apr 15, 2021
1 parent 4b2e76e commit 8e8cdf6
Show file tree
Hide file tree
Showing 17 changed files with 8 additions and 417 deletions.
3 changes: 0 additions & 3 deletions src/commands/dev/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,5 @@ pub fn dev(
);
}

if target.durable_objects.is_some() {
failure::bail!("Previewing a script that binds to a Durable Object Class is not supported using unauthenticated preview. Please use wrangler login or wrangler config.")
}
gcs::dev(target, server_config, local_protocol, verbose)
}
4 changes: 1 addition & 3 deletions src/commands/kv/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,14 @@ mod tests {
binding: "KV".to_string(),
},
],
durable_objects: None,
migrations: None,
name: "test-target".to_string(),
target_type: TargetType::Webpack,
webpack_config: None,
site: None,
vars: None,
text_blobs: None,
build: None,
usage_model: None,
build: None,
};
assert!(kv::get_namespace_id(&target_with_dup_kv_bindings, "").is_err());
}
Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ extern crate text_io;

mod build;
pub mod preview;
pub mod util;
pub use build::build_target;
pub mod commands;
pub mod deploy;
Expand Down
8 changes: 0 additions & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@ use wrangler::installer;
use wrangler::preview::{HttpMethod, PreviewOpt};
use wrangler::settings;
use wrangler::settings::global_user::GlobalUser;
use wrangler::settings::toml::migrations::{MigrationConfig, Migrations};
use wrangler::settings::toml::TargetType;
use wrangler::terminal::message::{Message, Output, StdOut};
use wrangler::terminal::{emoji, interactive, styles};
use wrangler::util::ApplyToApp;
use wrangler::version::background_check_for_updates;

fn main() -> Result<(), ExitFailure> {
Expand Down Expand Up @@ -576,7 +574,6 @@ fn run() -> Result<(), failure::Error> {
.takes_value(true)
.possible_value("json")
)
.apply(MigrationConfig::add_to_app)
,
)
.subcommand(
Expand Down Expand Up @@ -868,11 +865,6 @@ fn run() -> Result<(), failure::Error> {
let manifest = settings::toml::Manifest::new(config_path)?;
let env = matches.value_of("env");
let mut target = manifest.get_target(env, is_preview)?;
if let Some(adhoc) = MigrationConfig::from_matches(&matches) {
target.migrations = Some(Migrations {
migrations: vec![adhoc],
});
}

let deploy_config = manifest.get_deployments(env)?;
if matches.is_present("output") && matches.value_of("output") == Some("json") {
Expand Down
4 changes: 0 additions & 4 deletions src/preview/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ pub fn preview(
}
}

if target.durable_objects.is_some() {
failure::bail!("wrangler preview does not support previewing scripts that bind to durable object classes. Please use wrangler dev instead.");
}

build_target(&target)?;

let sites_preview: bool = target.site.is_some();
Expand Down
38 changes: 4 additions & 34 deletions src/settings/binding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,10 @@ use serde::Serialize;
#[serde(tag = "type")]
#[serde(rename_all = "snake_case")]
pub enum Binding {
WasmModule {
name: String,
part: String,
},
KvNamespace {
name: String,
namespace_id: String,
},
#[serde(rename = "durable_object_namespace")]
DurableObjectsClass {
name: String,
class_name: String,
script_name: Option<String>,
},
TextBlob {
name: String,
part: String,
},
PlainText {
name: String,
text: String,
},
WasmModule { name: String, part: String },
KvNamespace { name: String, namespace_id: String },
TextBlob { name: String, part: String },
PlainText { name: String, text: String },
}

impl Binding {
Expand All @@ -37,18 +19,6 @@ impl Binding {
Binding::KvNamespace { name, namespace_id }
}

pub fn new_durable_object_namespace(
name: String,
class_name: String,
script_name: Option<String>,
) -> Binding {
Binding::DurableObjectsClass {
name,
class_name,
script_name,
}
}

pub fn new_text_blob(name: String, part: String) -> Binding {
Binding::TextBlob { name, part }
}
Expand Down
27 changes: 0 additions & 27 deletions src/settings/toml/durable_objects.rs

This file was deleted.

2 changes: 0 additions & 2 deletions src/settings/toml/environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use serde::{Deserialize, Serialize};
use serde_with::rust::string_empty_as_none;

use crate::settings::toml::builder::Builder;
use crate::settings::toml::durable_objects::DurableObjects;
use crate::settings::toml::kv_namespace::ConfigKvNamespace;
use crate::settings::toml::route::RouteConfig;
use crate::settings::toml::site::Site;
Expand All @@ -31,7 +30,6 @@ pub struct Environment {
pub vars: Option<HashMap<String, String>>,
pub text_blobs: Option<HashMap<String, PathBuf>>,
pub triggers: Option<Triggers>,
pub durable_objects: Option<DurableObjects>,
}

impl Environment {
Expand Down
14 changes: 1 addition & 13 deletions src/settings/toml/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use crate::commands::{validate_worker_name, whoami, DEFAULT_CONFIG_PATH};
use crate::deploy::{self, DeployTarget, DeploymentSet};
use crate::settings::toml::builder::Builder;
use crate::settings::toml::dev::Dev;
use crate::settings::toml::durable_objects::DurableObjects;
use crate::settings::toml::environment::Environment;
use crate::settings::toml::kv_namespace::{ConfigKvNamespace, KvNamespace};
use crate::settings::toml::route::RouteConfig;
Expand Down Expand Up @@ -55,7 +54,6 @@ pub struct Manifest {
pub vars: Option<HashMap<String, String>>,
pub text_blobs: Option<HashMap<String, PathBuf>>,
pub triggers: Option<Triggers>,
pub durable_objects: Option<DurableObjects>,
#[serde(default, with = "string_empty_as_none")]
pub usage_model: Option<UsageModel>,
}
Expand Down Expand Up @@ -279,12 +277,7 @@ impl Manifest {
deployments.push(DeployTarget::Schedule(scheduled));
}

let durable_objects = match env {
Some(e) => e.durable_objects.as_ref(),
None => self.durable_objects.as_ref(),
};

if durable_objects.is_none() && deployments.is_empty() {
if deployments.is_empty() {
failure::bail!("No deployments specified!")
}

Expand Down Expand Up @@ -357,8 +350,6 @@ impl Manifest {
// to include the name of the environment
name: self.name.clone(), // Inherited
kv_namespaces: get_namespaces(self.kv_namespaces.clone(), preview)?, // Not inherited
durable_objects: self.durable_objects.clone(), // Not inherited
migrations: None, // TODO(soon) Allow migrations in wrangler.toml
site: self.site.clone(), // Inherited
vars: self.vars.clone(), // Not inherited
text_blobs: self.text_blobs.clone(), // Inherited
Expand All @@ -382,9 +373,6 @@ impl Manifest {
// don't inherit kv namespaces because it is an anti-pattern to use the same namespaces across multiple environments
target.kv_namespaces = get_namespaces(environment.kv_namespaces.clone(), preview)?;

// don't inherit durable object configuration
target.durable_objects = environment.durable_objects.clone();

// inherit site configuration
if let Some(site) = &environment.site {
target.site = Some(site.clone());
Expand Down
Loading

0 comments on commit 8e8cdf6

Please sign in to comment.