From 98847c0658cc4d277d9b3e0a8a92f7d9f3b56f05 Mon Sep 17 00:00:00 2001 From: Joshua Jerin Date: Wed, 7 Aug 2024 11:06:48 +0530 Subject: [PATCH 1/6] initial commit --- tembo-cli/src/cli/tembo_config.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tembo-cli/src/cli/tembo_config.rs b/tembo-cli/src/cli/tembo_config.rs index 799d3074d..a0184a5bc 100644 --- a/tembo-cli/src/cli/tembo_config.rs +++ b/tembo-cli/src/cli/tembo_config.rs @@ -140,3 +140,20 @@ pub struct LoadableLibrary { pub library_name: String, pub priority: i32, } + +#[derive(Serialize, Deserialize, Debug, Clone)] +pub struct TemboTomlConfig { + #[serde(rename = "instance_name")] + pub name: String, + pub environment: String, + pub cpu: String, + pub memory: String, + pub storage: String, + pub replicas: i32, + pub stack_type: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub postgres_configurations: Option>, + #[serde(skip_serializing_if = "Option::is_none")] + pub extensions: Option>, + pub pg_version: u8, +} From 77f11173e0010908369875d1c8e7e8c0b80dc4d7 Mon Sep 17 00:00:00 2001 From: Joshua Jerin Date: Wed, 7 Aug 2024 11:17:37 +0530 Subject: [PATCH 2/6] chrono crate update --- tembo-cli/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tembo-cli/Cargo.toml b/tembo-cli/Cargo.toml index 858580974..ce972627f 100644 --- a/tembo-cli/Cargo.toml +++ b/tembo-cli/Cargo.toml @@ -38,7 +38,7 @@ home = "0.5.5" semver = "1.0.18" mockall = "0.11.4" toml = "0.7.6" -chrono = { version = "0.4.29", features = ["serde"] } +chrono = { version = "0.4.38", features = ["serde"] } simplelog = { version = "^0.12.1", features = ["paris"] } clerk-rs = "0.1.7" jsonwebtoken = "8.3.0" From 5d1ecf24b2883098a8403c51f1b94c1d24d2e43f Mon Sep 17 00:00:00 2001 From: Joshua Jerin Date: Wed, 7 Aug 2024 12:07:48 +0530 Subject: [PATCH 3/6] update config --- tembo-cli/Cargo.toml | 2 +- tembo-cli/src/cli/tembo_config.rs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tembo-cli/Cargo.toml b/tembo-cli/Cargo.toml index ce972627f..858580974 100644 --- a/tembo-cli/Cargo.toml +++ b/tembo-cli/Cargo.toml @@ -38,7 +38,7 @@ home = "0.5.5" semver = "1.0.18" mockall = "0.11.4" toml = "0.7.6" -chrono = { version = "0.4.38", features = ["serde"] } +chrono = { version = "0.4.29", features = ["serde"] } simplelog = { version = "^0.12.1", features = ["paris"] } clerk-rs = "0.1.7" jsonwebtoken = "8.3.0" diff --git a/tembo-cli/src/cli/tembo_config.rs b/tembo-cli/src/cli/tembo_config.rs index a0184a5bc..d7b5195a8 100644 --- a/tembo-cli/src/cli/tembo_config.rs +++ b/tembo-cli/src/cli/tembo_config.rs @@ -143,17 +143,17 @@ pub struct LoadableLibrary { #[derive(Serialize, Deserialize, Debug, Clone)] pub struct TemboTomlConfig { + pub environment: String, #[serde(rename = "instance_name")] pub name: String, - pub environment: String, pub cpu: String, pub memory: String, pub storage: String, pub replicas: i32, - pub stack_type: Option, + pub stack_type: String, + pub pg_version: u8, #[serde(skip_serializing_if = "Option::is_none")] - pub postgres_configurations: Option>, + pub postgres_configurations: Option>, #[serde(skip_serializing_if = "Option::is_none")] - pub extensions: Option>, - pub pg_version: u8, + pub extensions: Option>>, } From cd68a6ca13afe6718c5fe57953ccfe5dfb4c4f72 Mon Sep 17 00:00:00 2001 From: Joshua Jerin Date: Fri, 9 Aug 2024 08:46:44 +0530 Subject: [PATCH 4/6] update toml --- tembo-cli/Cargo.lock | 12 ++++++------ tembo-cli/Cargo.toml | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tembo-cli/Cargo.lock b/tembo-cli/Cargo.lock index f897c90e4..73a036c9b 100644 --- a/tembo-cli/Cargo.lock +++ b/tembo-cli/Cargo.lock @@ -4713,9 +4713,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.7.8" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" +checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" dependencies = [ "serde", "serde_spanned", @@ -4734,9 +4734,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.19.15" +version = "0.22.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" dependencies = [ "indexmap 2.3.0", "serde", @@ -5555,9 +5555,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.5.40" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" dependencies = [ "memchr", ] diff --git a/tembo-cli/Cargo.toml b/tembo-cli/Cargo.toml index 858580974..816afafb1 100644 --- a/tembo-cli/Cargo.toml +++ b/tembo-cli/Cargo.toml @@ -37,7 +37,7 @@ serde_yaml = "0.9.17" home = "0.5.5" semver = "1.0.18" mockall = "0.11.4" -toml = "0.7.6" +toml = "0.8.19" chrono = { version = "0.4.29", features = ["serde"] } simplelog = { version = "^0.12.1", features = ["paris"] } clerk-rs = "0.1.7" From 4933063fd983def877d3223e7d82dc2d68eb33bf Mon Sep 17 00:00:00 2001 From: Joshua Jerin Date: Fri, 9 Aug 2024 09:58:21 +0530 Subject: [PATCH 5/6] turn enabled to option --- tembo-cli/src/cli/tembo_config.rs | 24 +----------------------- tembo-cli/src/cmd/apply.rs | 4 ++-- 2 files changed, 3 insertions(+), 25 deletions(-) diff --git a/tembo-cli/src/cli/tembo_config.rs b/tembo-cli/src/cli/tembo_config.rs index d7b5195a8..5f8594004 100644 --- a/tembo-cli/src/cli/tembo_config.rs +++ b/tembo-cli/src/cli/tembo_config.rs @@ -103,15 +103,10 @@ fn default_extensions() -> Option> { Some(HashMap::new()) } -fn default_as_true() -> bool { - true -} - #[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] pub struct Extension { pub version: Option, - #[serde(default = "default_as_true")] - pub enabled: bool, + pub enabled: Option, pub trunk_project: Option, pub trunk_project_version: Option, } @@ -140,20 +135,3 @@ pub struct LoadableLibrary { pub library_name: String, pub priority: i32, } - -#[derive(Serialize, Deserialize, Debug, Clone)] -pub struct TemboTomlConfig { - pub environment: String, - #[serde(rename = "instance_name")] - pub name: String, - pub cpu: String, - pub memory: String, - pub storage: String, - pub replicas: i32, - pub stack_type: String, - pub pg_version: u8, - #[serde(skip_serializing_if = "Option::is_none")] - pub postgres_configurations: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub extensions: Option>>, -} diff --git a/tembo-cli/src/cmd/apply.rs b/tembo-cli/src/cmd/apply.rs index eb5111abd..92886a75d 100644 --- a/tembo-cli/src/cmd/apply.rs +++ b/tembo-cli/src/cmd/apply.rs @@ -945,7 +945,7 @@ fn get_extensions( database: Some("postgres".to_string()), schema: None, version: version, - enabled: extension.enabled, + enabled: extension.enabled.is_some(), }]; vec_extensions.push(Extension { @@ -971,7 +971,7 @@ fn get_extensions_controller( database: String::new(), schema: None, version: None, - enabled: extension.enabled, + enabled: extension.enabled.is_some(), }); vec_extensions.push(ControllerExtension { From 515fe2b4fa79c927e33ae94660dd28e5f2efa759 Mon Sep 17 00:00:00 2001 From: Joshua Jerin Date: Sat, 10 Aug 2024 05:25:56 +0530 Subject: [PATCH 6/6] requested changes --- tembo-cli/src/cmd/apply.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tembo-cli/src/cmd/apply.rs b/tembo-cli/src/cmd/apply.rs index 92886a75d..7adb29c4e 100644 --- a/tembo-cli/src/cmd/apply.rs +++ b/tembo-cli/src/cmd/apply.rs @@ -945,7 +945,7 @@ fn get_extensions( database: Some("postgres".to_string()), schema: None, version: version, - enabled: extension.enabled.is_some(), + enabled: extension.enabled.unwrap_or(false), }]; vec_extensions.push(Extension { @@ -971,7 +971,7 @@ fn get_extensions_controller( database: String::new(), schema: None, version: None, - enabled: extension.enabled.is_some(), + enabled: extension.enabled.unwrap_or(false), }); vec_extensions.push(ControllerExtension {