Skip to content

Commit

Permalink
Add pganalyze app to temo-stacks crate (#544)
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Stanton <ian@tembo.io>
  • Loading branch information
ianstanton committed Feb 13, 2024
1 parent 4dc672c commit 0ffbb68
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tembo-stacks/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tembo-stacks/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "tembo-stacks"
description = "Tembo Stacks for Postgres"
version = "0.2.0"
version = "0.3.0"
authors = ["tembo.io"]
edition = "2021"
license = "Apache-2.0"
Expand Down
14 changes: 14 additions & 0 deletions tembo-stacks/src/apps/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ lazy_static! {
serde_yaml::from_str(include_str!("mq.yaml")).expect("mq.yaml not found");
pub static ref EMBEDDINGS: App =
serde_yaml::from_str(include_str!("embeddings.yaml")).expect("embeddings.yaml not found");
pub static ref PGANALYZE: App =
serde_yaml::from_str(include_str!("pganalyze.yaml")).expect("pganalyze.yaml not found");
}

// handling merging requirements coming from an App into the final
Expand Down Expand Up @@ -93,6 +95,18 @@ pub fn merge_app_reqs(
final_pg_configs.extend(pg_cfg);
}
}
AppType::PgAnalyze(config) => {
// There is only 1 app_service in the pganalyze app
let pg_analyze = PGANALYZE.clone();
let mut pg_analyze_app_svc = pg_analyze.app_services.unwrap()[0].clone();
// If there are user provided configs, overwrite the defaults with them
if let Some(cfg) = config {
pg_analyze_app_svc = merge_app_configs(pg_analyze_app_svc, cfg);
}
user_app_services.push(pg_analyze_app_svc);
// pganalyze only has app_service containers
// no extensions or trunk installs
}
AppType::Custom(custom_app) => {
user_app_services.push(custom_app);
}
Expand Down
3 changes: 3 additions & 0 deletions tembo-stacks/src/apps/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ pub enum AppType {
MQ(Option<AppConfig>),
#[serde(rename = "embeddings")]
Embeddings(Option<AppConfig>),
#[serde(rename = "pganalyze")]
PgAnalyze(Option<AppConfig>),
#[serde(rename = "custom")]
Custom(AppService),
}
Expand Down Expand Up @@ -67,6 +69,7 @@ impl TryFrom<AppService> for AppType {
"http" => Ok(AppType::HTTP(app_config)),
"mq-api" => Ok(AppType::MQ(app_config)),
"embeddings" => Ok(AppType::Embeddings(app_config)),
"pganalyze" => Ok(AppType::PgAnalyze(app_config)),
_ => {
// everything else is a custom app
Ok(AppType::Custom(app_service))
Expand Down

0 comments on commit 0ffbb68

Please sign in to comment.