use anyhow::Result;
use colored::Colorize;
const DOCKER_COMPOSE_TEMPLATE: &str = include_str!("../../../templates/stack/docker-compose.yml");
const INIT_DB_SCRIPT_TEMPLATE: &str = include_str!("../../../templates/stack/init-multiple-dbs.sh");
const RUNTIME_REGISTRY_TEMPLATE: &str =
include_str!("../../../templates/stack/runtime-registry.yaml");
const TEMPORAL_DYNAMIC_CONFIG_TEMPLATE: &str =
include_str!("../../../templates/stack/development-sql.yaml");
const SEAL_GATEWAY_CONFIG_TEMPLATE: &str =
include_str!("../../../templates/stack/seal-gateway-config.yaml");
pub struct StackFiles {
pub docker_compose: String,
pub init_db_script: String,
pub runtime_registry: String,
pub temporal_dynamic_config: String,
pub seal_gateway_config: String,
}
pub async fn fetch_stack(tag: &str) -> Result<StackFiles> {
println!();
println!("{}", "Loading bundled stack templates...".bold());
println!(" {} Using AEGIS image tag: {}", "✓".green(), tag);
println!(" {} Stack files ready", "✓".green());
Ok(StackFiles {
docker_compose: DOCKER_COMPOSE_TEMPLATE.replace("{{AEGIS_IMAGE_TAG}}", tag),
init_db_script: INIT_DB_SCRIPT_TEMPLATE.to_string(),
runtime_registry: RUNTIME_REGISTRY_TEMPLATE.to_string(),
temporal_dynamic_config: TEMPORAL_DYNAMIC_CONFIG_TEMPLATE.to_string(),
seal_gateway_config: SEAL_GATEWAY_CONFIG_TEMPLATE.to_string(),
})
}