feat: control default services via env vars

Read default postgres compose service name and default django compose
service name from env variables.

AHAB_POSTGRES_CONTAINER - defaults to `appserver`
AHAB_DJANGO_CONATINER - defaults to `postgresdb`

Default values are there for 100% backwards compatibility.
This commit is contained in:
2024-11-27 17:55:45 +01:00
parent 3077420db2
commit e7308bd5c6
4 changed files with 23 additions and 16 deletions

View File

@@ -36,9 +36,13 @@ fn main() -> Result<()> {
cli::Django::Shell => scripts::django::shell(),
cli::Django::Test => scripts::django::test(),
},
cli::Commands::Postgres { command } => match command {
cli::Postgres::Import { path } => scripts::postgres::import(&path),
cli::Postgres::Dump { path } => scripts::postgres::dump(&path),
},
cli::Commands::Postgres { command } => {
let db_container =
std::env::var("AHAB_POSTGRES_CONTAINER").unwrap_or("postgresdb".to_string());
match command {
cli::Postgres::Import { path } => scripts::postgres::import(&db_container, &path),
cli::Postgres::Dump { path } => scripts::postgres::dump(&db_container, &path),
}
}
}
}