mirror of
https://codeberg.org/icewind/haze.git
synced 2026-06-03 17:14:08 +02:00
allow pinning instances
This commit is contained in:
parent
0d8f3279ad
commit
81695aee4b
6 changed files with 93 additions and 14 deletions
17
src/main.rs
17
src/main.rs
|
|
@ -35,7 +35,7 @@ async fn main() -> Result<()> {
|
|||
match args {
|
||||
HazeArgs::Clean => {
|
||||
let list = Cloud::list(&mut docker, None, &config).await?;
|
||||
for cloud in list {
|
||||
for cloud in list.into_iter().filter(|cloud| !cloud.pinned) {
|
||||
if let Err(e) = cloud.destroy(&mut docker).await {
|
||||
eprintln!("Error while removing cloud: {:#}", e);
|
||||
}
|
||||
|
|
@ -48,17 +48,20 @@ async fn main() -> Result<()> {
|
|||
let mut services: Vec<_> = cloud.services.iter().map(Service::name).collect();
|
||||
services.push(cloud.db.name());
|
||||
let services = services.join(", ");
|
||||
let pin = if cloud.pinned { "*" } else { "" };
|
||||
match cloud.ip {
|
||||
Some(ip) => println!(
|
||||
"Cloud {}, {}, {}, running on http://{}",
|
||||
"Cloud {}{}, {}, {}, running on http://{}",
|
||||
cloud.id,
|
||||
pin,
|
||||
cloud.php.name(),
|
||||
services,
|
||||
ip
|
||||
),
|
||||
None => println!(
|
||||
"Cloud {}, {}, {}, not running",
|
||||
"Cloud {}{}, {}, {}, not running",
|
||||
cloud.id,
|
||||
pin,
|
||||
cloud.php.name(),
|
||||
services
|
||||
),
|
||||
|
|
@ -283,6 +286,14 @@ async fn main() -> Result<()> {
|
|||
.await?;
|
||||
cloud.destroy(&mut docker).await?;
|
||||
}
|
||||
HazeArgs::Pin { filter } => {
|
||||
let cloud = Cloud::get_by_filter(&mut docker, filter, &config).await?;
|
||||
cloud.pin(&mut docker).await?;
|
||||
}
|
||||
HazeArgs::Unpin { filter } => {
|
||||
let cloud = Cloud::get_by_filter(&mut docker, filter, &config).await?;
|
||||
cloud.unpin(&mut docker).await?;
|
||||
}
|
||||
};
|
||||
|
||||
Ok(())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue