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

@@ -63,8 +63,9 @@ pub fn make_command(app: &PathBuf, name: &str) -> Result<()> {
pub fn manage(rest: &[String]) -> Result<()> {
let dsm = get_django_settings_module()?;
let container = env::var("AHAB_DJANGO_CONTAINER").unwrap_or("appserver".to_string());
let joined = rest.join(" ");
let command = format!("run --rm appserver python manage.py {joined} --settings={dsm}");
let command = format!("run --rm {container} python manage.py {joined} --settings={dsm}");
CommandBuilder::docker_compose().args(&command).exec()
}