mirror of
https://github.com/katanemo/plano.git
synced 2026-04-28 02:23:56 +02:00
remove Python from Docker: use Rust CLI for config generation
This commit is contained in:
parent
2e3744fd1a
commit
6cf0c4ff7b
5 changed files with 66 additions and 20 deletions
33
crates/plano-cli/src/commands/render_config.rs
Normal file
33
crates/plano-cli/src/commands/render_config.rs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
use std::path::Path;
|
||||
|
||||
use anyhow::Result;
|
||||
|
||||
use crate::config;
|
||||
|
||||
/// Render config files for Docker/supervisord use.
|
||||
/// Reads paths from environment variables (matching the old Python config_generator).
|
||||
pub async fn run() -> Result<()> {
|
||||
let config_file =
|
||||
std::env::var("PLANO_CONFIG_FILE").unwrap_or_else(|_| "/app/plano_config.yaml".to_string());
|
||||
let schema_file = std::env::var("PLANO_CONFIG_SCHEMA_FILE")
|
||||
.unwrap_or_else(|_| "plano_config_schema.yaml".to_string());
|
||||
let template_root = std::env::var("TEMPLATE_ROOT").unwrap_or_else(|_| "./".to_string());
|
||||
let template_file = std::env::var("ENVOY_CONFIG_TEMPLATE_FILE")
|
||||
.unwrap_or_else(|_| "envoy.template.yaml".to_string());
|
||||
let config_rendered = std::env::var("PLANO_CONFIG_FILE_RENDERED")
|
||||
.unwrap_or_else(|_| "/app/plano_config_rendered.yaml".to_string());
|
||||
let envoy_rendered = std::env::var("ENVOY_CONFIG_FILE_RENDERED")
|
||||
.unwrap_or_else(|_| "/etc/envoy/envoy.yaml".to_string());
|
||||
|
||||
let template_path = Path::new(&template_root).join(&template_file);
|
||||
|
||||
config::validate_and_render(
|
||||
Path::new(&config_file),
|
||||
Path::new(&schema_file),
|
||||
&template_path,
|
||||
Path::new(&envoy_rendered),
|
||||
Path::new(&config_rendered),
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue