mirror of
https://codeberg.org/icewind/haze.git
synced 2026-06-03 09:04:12 +02:00
allow custom pre-setup config options
This commit is contained in:
parent
80d71bd7a0
commit
b3a1e80f6f
5 changed files with 25 additions and 5 deletions
12
src/cloud.rs
12
src/cloud.rs
|
|
@ -15,7 +15,7 @@ use flate2::read::GzDecoder;
|
|||
use futures_util::future::try_join_all;
|
||||
use miette::{IntoDiagnostic, Report, Result, WrapErr};
|
||||
use petname::petname;
|
||||
use serde_json::{Map, Value};
|
||||
use serde_json::Value;
|
||||
use std::borrow::Cow;
|
||||
use std::collections::HashMap;
|
||||
use std::fmt::Display;
|
||||
|
|
@ -297,7 +297,15 @@ impl Cloud {
|
|||
.wrap_err_with(|| format!("Failed to setup work directory {}", mapping.source))?;
|
||||
}
|
||||
|
||||
let mut nc_config = Value::Object(Map::new());
|
||||
let mut nc_config = Value::Object(
|
||||
config
|
||||
.auto_setup
|
||||
.config
|
||||
.clone()
|
||||
.into_iter()
|
||||
.map(|(key, value)| (key, serde_json::to_value(value).unwrap()))
|
||||
.collect(),
|
||||
);
|
||||
nc_config["apps_paths"] = Value::Array(
|
||||
once("apps")
|
||||
.chain(
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ use std::convert::TryFrom;
|
|||
use std::env::home_dir;
|
||||
use std::fs::read_to_string;
|
||||
use std::net::IpAddr;
|
||||
use toml::map::Map;
|
||||
use toml::Value;
|
||||
|
||||
#[derive(Debug, Deserialize, Default)]
|
||||
|
|
@ -87,6 +88,8 @@ pub struct HazeAutoSetupConfig {
|
|||
pub disable_apps: Vec<String>,
|
||||
#[serde(default)]
|
||||
pub post_setup: Vec<String>,
|
||||
#[serde(default)]
|
||||
pub config: Map<String, Value>,
|
||||
}
|
||||
|
||||
impl Default for HazeAutoSetupConfig {
|
||||
|
|
@ -98,6 +101,7 @@ impl Default for HazeAutoSetupConfig {
|
|||
enable_apps: Vec::default(),
|
||||
disable_apps: Vec::default(),
|
||||
post_setup: Vec::default(),
|
||||
config: Map::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue