Compare commits

4 Commits

7 changed files with 10 additions and 10 deletions

4
Cargo.lock generated
View File

@@ -1,10 +1,10 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
version = 4
[[package]]
name = "ahab"
version = "0.3.0"
version = "0.4.0"
dependencies = [
"anyhow",
"clap",

View File

@@ -2,7 +2,7 @@
name = "ahab"
description = "docker cli wrapper"
readme = "README.md"
version = "0.3.1"
version = "0.4.0"
edition = "2021"
license = "MIT"
authors = ["Matej Janežič <janezic.mj@gmail.com>"]

View File

@@ -21,5 +21,5 @@ Completion files are generated **during build process** in `target/*/build/*/out
Currently `ahab` respects three environment variables.
- `COMPOSE_FILE`: control which docker-compose file is used - defaults to `docker/local/docker-compose.yaml`
- `AHAB_DJANGO_CONTAINER`: control which compose service is used for sending django commands - defaults to `appserver`
- `AHAB_POSTGRES_CONTAINER`: control which compose service is used for sending postgres commands - defaults to `postgresdb`
- `AHAB_DJANGO_CONTAINER`: control which compose service is used for sending django commands - defaults to `django`
- `AHAB_POSTGRES_CONTAINER`: control which compose service is used for sending postgres commands - defaults to `db`

View File

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

View File

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

View File

@@ -12,7 +12,7 @@ pub fn down() -> Result<()> {
}
pub fn exec(rest: &[String]) -> Result<()> {
let container = std::env::var("AHAB_DJANGO_CONTAINER").unwrap_or("appserver".to_string());
let container = std::env::var("AHAB_DJANGO_CONTAINER").unwrap_or("django".to_string());
CommandBuilder::docker_compose()
.args("exec")
.args(&container)
@@ -26,6 +26,7 @@ pub fn ps() -> Result<()> {
/// Start containers via `docker compose start`. Optionally pass containers to be started.
/// ```
/// # use ahab::scripts::docker_compose::start;
/// start(None);
/// ```
/// is roughly the same as