mirror of
https://codeberg.org/icewind/haze.git
synced 2026-06-03 17:14:08 +02:00
allow setting name
This commit is contained in:
parent
0792f79d7c
commit
0d8f3279ad
1 changed files with 9 additions and 1 deletions
10
src/cloud.rs
10
src/cloud.rs
|
|
@ -30,6 +30,7 @@ use tokio::time::sleep;
|
||||||
|
|
||||||
#[derive(Clone, Default, Debug, Eq, PartialEq)]
|
#[derive(Clone, Default, Debug, Eq, PartialEq)]
|
||||||
pub struct CloudOptions {
|
pub struct CloudOptions {
|
||||||
|
name: Option<String>,
|
||||||
db: Database,
|
db: Database,
|
||||||
php: PhpVersion,
|
php: PhpVersion,
|
||||||
services: Vec<Service>,
|
services: Vec<Service>,
|
||||||
|
|
@ -44,6 +45,7 @@ impl CloudOptions {
|
||||||
{
|
{
|
||||||
let mut db = None;
|
let mut db = None;
|
||||||
let mut php = None;
|
let mut php = None;
|
||||||
|
let mut name = None;
|
||||||
let mut services = Vec::new();
|
let mut services = Vec::new();
|
||||||
let mut app_package = Vec::new();
|
let mut app_package = Vec::new();
|
||||||
|
|
||||||
|
|
@ -60,12 +62,16 @@ impl CloudOptions {
|
||||||
} else if option.as_ref().ends_with(".tar.gz") {
|
} else if option.as_ref().ends_with(".tar.gz") {
|
||||||
app_package.push(option.to_string().into());
|
app_package.push(option.to_string().into());
|
||||||
let _ = args.next();
|
let _ = args.next();
|
||||||
|
} else if option.as_ref() == "--name" {
|
||||||
|
let _ = args.next();
|
||||||
|
name = args.next().map(|s| s.into());
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(CloudOptions {
|
Ok(CloudOptions {
|
||||||
|
name,
|
||||||
db: db.unwrap_or_default(),
|
db: db.unwrap_or_default(),
|
||||||
php: php.unwrap_or_default(),
|
php: php.unwrap_or_default(),
|
||||||
services,
|
services,
|
||||||
|
|
@ -159,7 +165,9 @@ impl Cloud {
|
||||||
options: CloudOptions,
|
options: CloudOptions,
|
||||||
config: &HazeConfig,
|
config: &HazeConfig,
|
||||||
) -> Result<Self> {
|
) -> Result<Self> {
|
||||||
let id = format!("haze-{}", petname(2, "-"));
|
let id = options
|
||||||
|
.name
|
||||||
|
.unwrap_or_else(|| format!("haze-{}", petname(2, "-")));
|
||||||
|
|
||||||
let workdir = config.work_dir.join(&id);
|
let workdir = config.work_dir.join(&id);
|
||||||
let app_package_dir = workdir.join("app_package");
|
let app_package_dir = workdir.join("app_package");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue